Skip to content
  • ckulakowski's avatar
    Chromium doesn't compile with -Wglobal-constructors · 656950c2
    ckulakowski authored
    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}
    656950c2