Add -Wshorten-64-to-32 flag to mac builds.
authorbalazs.kilvady <balazs.kilvady@imgtec.com>
Tue, 14 Jul 2015 16:05:20 +0000 (09:05 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 14 Jul 2015 16:05:29 +0000 (16:05 +0000)
BUG=

Review URL: https://codereview.chromium.org/1237753004

Cr-Commit-Position: refs/heads/master@{#29652}

build/standalone.gypi
src/base/platform/time.cc
src/gdb-jit.cc

index 788b96e..3b87060 100644 (file)
               'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
               'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x',  # -std=gnu++0x
             },
+            'conditions': [
+              ['v8_target_arch=="x64" or v8_target_arch=="arm64" \
+                or v8_target_arch=="mips64el"', {
+                'xcode_settings': {'WARNING_CFLAGS': ['-Wshorten-64-to-32']},
+              }],
+            ],
           }],
         ],
         'target_conditions': [
index b6a11cf..7e4c8fc 100644 (file)
@@ -111,7 +111,7 @@ TimeDelta TimeDelta::FromMachTimespec(struct mach_timespec ts) {
 struct mach_timespec TimeDelta::ToMachTimespec() const {
   struct mach_timespec ts;
   DCHECK(delta_ >= 0);
-  ts.tv_sec = delta_ / Time::kMicrosecondsPerSecond;
+  ts.tv_sec = static_cast<unsigned>(delta_ / Time::kMicrosecondsPerSecond);
   ts.tv_nsec = (delta_ % Time::kMicrosecondsPerSecond) *
       Time::kNanosecondsPerMicrosecond;
   return ts;
index 2746806..57b5811 100644 (file)
@@ -355,17 +355,13 @@ class ELFSection : public DebugSectionBase<ELFSectionHeader> {
 #if defined(__MACH_O)
 class MachOTextSection : public MachOSection {
  public:
-  MachOTextSection(uintptr_t align,
-                   uintptr_t addr,
-                   uintptr_t size)
-      : MachOSection("__text",
-                     "__TEXT",
-                     align,
+  MachOTextSection(uint32_t align, uintptr_t addr, uintptr_t size)
+      : MachOSection("__text", "__TEXT", align,
                      MachOSection::S_REGULAR |
                          MachOSection::S_ATTR_SOME_INSTRUCTIONS |
                          MachOSection::S_ATTR_PURE_INSTRUCTIONS),
         addr_(addr),
-        size_(size) { }
+        size_(size) {}
 
  protected:
   virtual void PopulateHeader(Writer::Slot<Header> header) {
@@ -588,7 +584,8 @@ class MachO BASE_EMBEDDED {
     Writer::Slot<MachOSection::Header> headers =
         w->CreateSlotsHere<MachOSection::Header>(sections_.length());
     cmd->fileoff = w->position();
-    header->sizeofcmds = w->position() - load_command_start;
+    header->sizeofcmds =
+        static_cast<uint32_t>(w->position() - load_command_start);
     for (int section = 0; section < sections_.length(); ++section) {
       sections_[section]->PopulateHeader(headers.at(section));
       sections_[section]->WriteBody(headers.at(section), w);