Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOCAL_CFLAGS do not disable warnings in Clang #307

Closed
alexcohn opened this issue Mar 2, 2017 · 8 comments
Closed

LOCAL_CFLAGS do not disable warnings in Clang #307

alexcohn opened this issue Mar 2, 2017 · 8 comments
Assignees
Milestone

Comments

@alexcohn
Copy link

alexcohn commented Mar 2, 2017

Description

Switching to Clang from GCC in r14, we have a problem with compilation of some 3rd party libraries, e.g. gumbo-query. See google/gumbo-parser#377 for details.

The problem specific to NDK is that when we switch to Clang, we cannot silence the warnings by tuning LOCAL_CFLAGS for the specific library the way we used to, with GCC. The reason is that when I turn on the warnings with APP_CFLAGS+=-Wall, this goes after the LOCAL_CFLAGS, and with Clang, -Wall overrides -Wno-unused-variable.

Environment Details

  • NDK Version: 14.0.3675639-beta2
  • Build sytem: ndk-build
  • Host OS: Mac
  • Compiler: Clang
  • ABI: checked with x86, but is probably relevant to the others.
@DanAlbert DanAlbert self-assigned this Mar 2, 2017
@DanAlbert DanAlbert added this to the r15 milestone Mar 2, 2017
@DanAlbert
Copy link
Member

Is this actually unique to r14?

@alexcohn
Copy link
Author

alexcohn commented Mar 2, 2017 via email

@DanAlbert
Copy link
Member

@DanAlbert
Copy link
Member

Merged into master and I've cherry-picked to r15. It probably won't be in r15 beta 1, but if I need to respin that yet again it will be.

@DanAlbert
Copy link
Member

FYI, I sent an email to one of the owners of the gumbo lib to see if we can get those warnings fixed rather than just suppressed.

@alexcohn
Copy link
Author

Cool, I did not see reaction from gumbo on my request, and the pull request that fixes this specific warning is pending since Oct 2015.

But gumbo is definitely not the only/last library on GitHub that compiles with warnings in Clang, or will compile with warnings in the next version of Clang. That's why a fix for Clang or NDK is required.

I believe that it is very important to encourage use of -Wall in APP_CFLAGS.

@DanAlbert
Copy link
Member

Turns out we are respinning beta 1, so I've cherry-picked this. Should be available some time next week.

@enh
Copy link
Contributor

enh commented Apr 8, 2017

fix now available in r15beta1...

a252539783 pushed a commit to a252539783/aosp-platform-ndk that referenced this issue May 3, 2017
`APP_CFLAGS` is the best place to put things like `-Wall -Werror`,
but with Clang the order of warning flags matters. If the
Application.mk settings come after the module level settings, modules
can't override global settings.

Test: ./run_tests.py --filter LOCAL_CFLAGS-beats-APP_CFLAGS
Bug: android/ndk#307
Change-Id: I3b7f1488fb2795a3fbbac53226e67b21a85b5b95
(cherry picked from commit 601456b)
a252539783 pushed a commit to a252539783/aosp-platform-ndk that referenced this issue May 3, 2017
`APP_CFLAGS` is the best place to put things like `-Wall -Werror`,
but with Clang the order of warning flags matters. If the
Application.mk settings come after the module level settings, modules
can't override global settings.

Test: ./run_tests.py --filter LOCAL_CFLAGS-beats-APP_CFLAGS
Bug: android/ndk#307
Change-Id: I3b7f1488fb2795a3fbbac53226e67b21a85b5b95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants