summaryrefslogtreecommitdiff
path: root/coreconf/config.gypi
diff options
context:
space:
mode:
authorMartin Thomson <mt@lowentropy.net>2019-10-28 22:55:09 +0000
committerMartin Thomson <mt@lowentropy.net>2019-10-28 22:55:09 +0000
commit021a5d411267b3fc51fac4034452e2a74306c45d (patch)
tree41d290ec762fcc28095fcdef4510679f8f87e5ea /coreconf/config.gypi
parentea541a79dd10a11fbcd861101ebe3d49aa5c8814 (diff)
downloadnss-hg-021a5d411267b3fc51fac4034452e2a74306c45d.tar.gz
Bug 1590972 - Use -std=c99 for all C code, r=jcj
This switches to using -std=c99 for compiling all C code. Previously, we only enabled this option for lib/freebl and lib/ssl. For Linux, this means we need to define _DEFAULT_SOURCE to access some of the functions we use. On glibc 2.12 (our oldest supported version), we also need to define _BSD_SOURCE to access these functions. The only tricky part is dealing with partial C99 implementation in gcc 4.4. From what I've seen, the only problem is that - in that mode - it doesn't support nesting of unnamed fields: https://gcc.gnu.org/onlinedocs/gcc-4.4.7/gcc/Unnamed-Fields.html This also switches from -std=c++0x to -std=c++11 as the 0x variant, though identical in meaning, is deprecated. Differential Revision: https://phabricator.services.mozilla.com/D50421
Diffstat (limited to 'coreconf/config.gypi')
-rw-r--r--coreconf/config.gypi7
1 files changed, 6 insertions, 1 deletions
diff --git a/coreconf/config.gypi b/coreconf/config.gypi
index f4426ac32..3b049111a 100644
--- a/coreconf/config.gypi
+++ b/coreconf/config.gypi
@@ -355,6 +355,8 @@
'LINUX2_1',
'LINUX',
'linux',
+ '_DEFAULT_SOURCE', # for <endian.h> functions, strdup, realpath, and getentropy
+ '_BSD_SOURCE', # for the above in glibc <= 2.19
],
}],
[ 'OS=="dragonfly" or OS=="freebsd"', {
@@ -391,8 +393,11 @@
'-ffunction-sections',
'-fdata-sections',
],
+ 'cflags_c': [
+ '-std=c99',
+ ],
'cflags_cc': [
- '-std=c++0x',
+ '-std=c++11',
],
'ldflags': [
'-z', 'noexecstack',