-Winline-new-delete produces lots of warnings on android builds

RESOLVED FIXED in Firefox 68

Status

()

defect
RESOLVED FIXED
3 months ago
3 months ago

People

(Reporter: kats, Assigned: froydnj)

Tracking

unspecified
mozilla68
Points:
---

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(2 attachments)

Doing android builds I get tons and tons of these warnings so if my build eventually fails I have to spend a while trying to find the actual error message amongst all this output. the warning is for operator new, operator new[], operator delete and operator delete[].

 1:52.60 /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/mozalloc.h:134:21: warning: replacement function 'operator new' cannot be declared 'inline' [-Winline-new-delete]
 1:52.60 MOZALLOC_EXPORT_NEW MOZ_ALWAYS_INLINE_EVEN_DEBUG void* operator new(
 1:52.60                     ^
 1:52.60 /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/Attributes.h:27:71: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
 1:52.60 #  define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
 1:52.60                                                                       ^
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/ipc/ipdl/UnifiedProtocols7.cpp:2:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/ipc/ipdl/PBrowser.cpp:7:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/GfxMessageUtils.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/FilterSupport.h:11:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/RefPtr.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/AlreadyAddRefed.h:12:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/Assertions.h:23:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/nsTraceRefcnt.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/nscore.h:20:
 1:52.60 /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/mozalloc.h:139:21: warning: replacement function 'operator new[]' cannot be declared 'inline' [-Winline-new-delete]
 1:52.60 MOZALLOC_EXPORT_NEW MOZ_ALWAYS_INLINE_EVEN_DEBUG void* operator new[](
 1:52.60                     ^
 1:52.60 /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/Attributes.h:27:71: note: expanded from macro 'MOZ_ALWAYS_INLINE_EVEN_DEBUG'
 1:52.60 #  define MOZ_ALWAYS_INLINE_EVEN_DEBUG __attribute__((always_inline)) inline
 1:52.60                                                                       ^
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/ipc/ipdl/UnifiedProtocols7.cpp:2:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/ipc/ipdl/PBrowser.cpp:7:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/GfxMessageUtils.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/FilterSupport.h:11:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/RefPtr.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/AlreadyAddRefed.h:12:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/mozilla/Assertions.h:23:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/nsTraceRefcnt.h:10:
 1:52.60 In file included from /home/kats/zspace/gecko-mobile/obj-android-x86-debug/dist/include/nscore.h:20:

We're supposed to be turning that warning off:

https://searchfox.org/mozilla-central/source/build/moz.configure/warnings.configure#111

Can you post your config.log? Maybe that will tell use why we're not detecting it.

Flags: needinfo?(kats)
Posted file config.log

Relevant snippet:

INFO: checking whether the C++ compiler supports -Wno-inline-new-delete...       
DEBUG: Creating `/home/kats/tmp/conftest.NxQyKf.cpp` with content:               
DEBUG: | int                                                                     
DEBUG: | main(void)                                                              
DEBUG: | {                                                                       
DEBUG: |                                                                         
DEBUG: |   ;                                                                     
DEBUG: |   return 0;                                                             
DEBUG: | }                                                                       
DEBUG: Executing: `/usr/bin/ccache /home/kats/.mozbuild/clang/bin/clang++ --target=i686-linux-android -Werror -Winline-new-delete -c -isystem /home/kats/.mozbuild/android-ndk/sysroot/usr/include/i686-linux-android -isystem /home/kats/.mozbuild/android-ndk/sysroot/usr/include -gcc-toolchain /home/kats/.mozbuild/android-ndk/toolchains/x86-4.9/prebuilt/linux-x86_64 -D__ANDROID_API__=16 -stdlib=libstdc++ -I/home/kats/.mozbuild/android-ndk/sources/cxx-stl/llvm-libc++/include -I/home/kats/.mozbuild/android-ndk/sources/android/support/include -I/home/kats/.mozbuild/android-ndk/sources/cxx-stl/llvm-libc++abi/include /home/kats/tmp/conftest.NxQyKf.cpp`
DEBUG: The command returned non-zero exit status 1.                              
DEBUG: Its error output was:                                                     
DEBUG: | clang-8: error: argument unused during compilation: '-stdlib=libstdc++' [-Werror,-Wunused-command-line-argument]
INFO: no                                                             
Flags: needinfo?(kats)

And my mozconfig:

# Global options
mk_add_options AUTOCLOBBER=1

# Build Fennec
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-android-x86-debug

# Build Firefox for Android:
ac_add_options --enable-application=mobile/android
ac_add_options --target=i686-linux-android

# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="/home/kats/.mozbuild/android-sdk-linux"
ac_add_options --with-android-ndk="/home/kats/.mozbuild/android-ndk"

# Build options
ac_add_options --enable-debug
ac_add_options --enable-debug-symbols
ac_add_options --enable-optimize="-Og"
ac_add_options --disable-elf-hack
ac_add_options --enable-tests
# ac_add_options --enable-warnings-as-errors
# ac_add_options --enable-dump-painting
ac_add_options --disable-crashreporter
ac_add_options --enable-webrender-debugger

# Use ccache
ac_add_options --with-ccache

export CC="/home/kats/.mozbuild/clang/bin/clang"
export CXX="/home/kats/.mozbuild/clang/bin/clang++"
export HOST_CC="/home/kats/.mozbuild/clang/bin/clang"
export HOST_CXX="/home/kats/.mozbuild/clang/bin/clang++"

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #2)

DEBUG: | clang-8: error: argument unused during compilation: '-stdlib=libstdc++' [-Werror,-Wunused-command-line-argument]

That's just stupid. I wonder if this is a recent clang thing.

Agreed that it's stupid. I'm not sure why it's not happening in automation though. The clang I'm using is the one in ~/.mozbuild which should match the one from automation. I also tried adding the --gcc-toolchain argument and I still get the same problem.

(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #5)

Agreed that it's stupid. I'm not sure why it's not happening in automation though. The clang I'm using is the one in ~/.mozbuild which should match the one from automation. I also tried adding the --gcc-toolchain argument and I still get the same problem.

You're using ccache and automation is using sccache? Wonder if ccache's processing is getting in the way of some normal logic in the compiler.

Using ccache apparently interferes with how flag checking is done when
we're using clang as our compiler. We can work around this by adding
a few more flags to flag checking.

Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb867ce4e9ce
ignore unrelated errors when checking compiler flags with ccache; r=chmanchester
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → nfroyd
You need to log in before you can comment on or make changes to this bug.