New issue
Advanced search Search tips

Issue 686669 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Chromium doesn't compile with -Wglobal-constructors

Project Member Reported by ckulakow...@opera.com, Jan 30 2017

Issue description

Chrome Version: 57.0.2979.0
OS: Linux

What steps will reproduce the problem?
Try to compile chromium with clang compilation flag -Wglobal-constructors.

What is the expected result?
Chromium compiles.

What happens instead?
Chromium fails to compile.

We compile chromium with clang flag -Wglobal-constructors in our
project. We have following compilation error during compilation
of user_input_tracker.cc:

../../chrome/browser/page_load_metrics/user_input_tracker.cc:27:11:
error: declaration requires a global constructor [-Werror,-Wglobal-constructors]
const int kRateLimitClampMillis = (kOldestAllowedEventAgeSeconds * 1000) /

In order to get rid of this global constructor I recommend to declare
static class variable UserInputTracker::kMaxTrackedEvents and global
variable kRateLimitClampMillis as constexpr which will be expanded to
numerical value during compilation.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Jan 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/656950c2f6ebeae22139d9753eca81f213c74b53

commit 656950c2f6ebeae22139d9753eca81f213c74b53
Author: ckulakowski <ckulakowski@opera.com>
Date: Mon Jan 30 16:42:48 2017

Chromium doesn't compile with -Wglobal-constructors

We compile chromium with clang flag -Wglobal-constructors in our
project. We have following compilation error during compilation
of user_input_tracker.cc:

../../chrome/browser/page_load_metrics/user_input_tracker.cc:27:11:
error: declaration requires a global constructor [-Werror,-Wglobal-constructors]
const int kRateLimitClampMillis = (kOldestAllowedEventAgeSeconds * 1000) /

In order to get rid of this global constructor I recommend to declare
static class variable UserInputTracker::kMaxTrackedEvents and global
variable kRateLimitClampMillis as constexpr which will be expanded to
numerical value during compilation.

BUG= 686669 

Review-Url: https://codereview.chromium.org/2662803002
Cr-Commit-Position: refs/heads/master@{#447000}

[modify] https://crrev.com/656950c2f6ebeae22139d9753eca81f213c74b53/chrome/browser/page_load_metrics/user_input_tracker.cc
[modify] https://crrev.com/656950c2f6ebeae22139d9753eca81f213c74b53/chrome/browser/page_load_metrics/user_input_tracker.h

Cc: dtapu...@chromium.org
Is this fixed now? Can it be closed?
Yes, fix landed on master and the issue can be closed.
Status: Fixed (was: Untriaged)

Sign in to add a comment