Closed Bug 1309505 Opened 9 years ago Closed 9 years ago

Add -Werror to gyp builds

Categories

(NSS :: Build, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: franziskus, Unassigned)

References

Details

Attachments

(1 file)

All warnings must be errors in gyp builds as well.
Ted, can you point us into the right direction here? Or are you taking this on?
Flags: needinfo?(ted)
I am not likely to get to this right away. If you'd like to try fixing it, you probably want to do something like: 1) Add an "enable_werror" variable in the variables section of config.gypi: https://hg.mozilla.org/projects/nss/file/tip/coreconf/config.gypi#l84 It looks like this defaults to on on everything but Android right now? If that's the case you might need to put a condition in the previous section to set it per-platform: https://hg.mozilla.org/projects/nss/file/tip/coreconf/config.gypi#l20 and then copy it out to the higher scope like 'enable_werror%': '<(enable_werror)', 2) For each platform you will need to add a condition somewhere on '<(enable_werror)==1' to set the appropriate flags. Linux could go here: https://hg.mozilla.org/projects/nss/file/tip/coreconf/config.gypi#l240 OS X could go here: https://hg.mozilla.org/projects/nss/file/tip/coreconf/config.gypi#l217 (and it looks like I left a note as to what is needed, something like https://dxr.mozilla.org/mozilla-beta/source/media/webrtc/trunk/build/common.gypi#1881 ) Windows could go here: https://hg.mozilla.org/projects/nss/file/tip/coreconf/config.gypi#l204 and it would use something like this: https://github.com/springmeyer/gyp/blob/master/test/win/compiler-flags/warning-level.gyp#L14
Flags: needinfo?(ted)
Attached patch gyp-werror.patchSplinter Review
So this works for c files on Linux (and I guess mac). I don't think we need an extra variable as we want Werror always enabled when possible (so only doing an exception for Android for now). What I noticed is that ninja doesn't seem to pick up changes in the external_tests directory and doesn't pass on cflags_cc to the cpp code in there. I don't see anything in the gyp files that would explain this.
Attachment #8802014 - Flags: review?(ted)
Comment on attachment 8802014 [details] [diff] [review] gyp-werror.patch Review of attachment 8802014 [details] [diff] [review]: ----------------------------------------------------------------- ::: coreconf/config.gypi @@ +263,5 @@ > 'ANDROID', > ], > }], > [ 'OS=="mac"', { > + 'cflags': [ Looking at your comment again I guess this isn't working. I'll have to test on a mac.
Comment on attachment 8802014 [details] [diff] [review] gyp-werror.patch Review of attachment 8802014 [details] [diff] [review]: ----------------------------------------------------------------- The cpp problems came from missing files in the ssl_gtest.gyp. Let me have another look at this.
Attachment #8802014 - Flags: review?(ted)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.28
Depends on: 1321296
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: