Commit c85c6c91 authored by Tom Anderson's avatar Tom Anderson Committed by Commit Bot

Stop using -std=gnu*

BUG=427584
R=thakis
TBR=sbc

Change-Id: I4a6f67aa6ddaf8ab78719a3c925fcd732b8c28bf
Reviewed-on: https://chromium-review.googlesource.com/1149337
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581478}
parent 39a62a91
...@@ -547,16 +547,22 @@ config("compiler") { ...@@ -547,16 +547,22 @@ config("compiler") {
cxx11_override = use_cxx11 cxx11_override = use_cxx11
} }
# gnu11/gnu++11 instead of c11/c++11 is needed because some code uses typeof() # Since we build with -std=c* and not -std=gnu*, _GNU_SOURCE will not be
# (a GNU extension). # defined by the compiler. However, lots of code relies on the non-standard
# TODO(thakis): Eventually switch this to c++11 instead, # features that _GNU_SOURCE enables, so define it manually.
# http://crbug.com/427584 defines += [ "_GNU_SOURCE" ]
cflags_c += [ "-std=gnu11" ]
cflags_c += [ "-std=c11" ]
if (cxx11_override) { if (cxx11_override) {
# Override Chromium's default for projects that wish to stay on C++11. # Override Chromium's default for projects that wish to stay on C++11.
cflags_cc += [ "-std=gnu++11" ] cflags_cc += [ "-std=c++11" ]
} else { } else {
cflags_cc += [ "-std=gnu++14" ] cflags_cc += [ "-std=c++14" ]
}
if (is_nacl) {
# Undefine __STRICT_ANSI__ to get non-standard features which would
# otherwise not be enabled by NaCl's sysroots.
cflags += [ "-U__STRICT_ANSI__" ]
} }
} else if (!is_win && !is_nacl) { } else if (!is_win && !is_nacl) {
if (target_os == "android") { if (target_os == "android") {
......
...@@ -82,7 +82,7 @@ EXTERN_C_BEGIN ...@@ -82,7 +82,7 @@ EXTERN_C_BEGIN
#define WRAP(name) __nacl_irt_##name##_wrap #define WRAP(name) __nacl_irt_##name##_wrap
// Declare REAL function pointer. // Declare REAL function pointer.
#define DECLARE_REAL_PTR(name) typeof(__nacl_irt_##name) REAL(name); #define DECLARE_REAL_PTR(name) __typeof__(__nacl_irt_##name) REAL(name);
// Assign the REAL function pointer. // Assign the REAL function pointer.
#define ASSIGN_REAL_PTR(name) \ #define ASSIGN_REAL_PTR(name) \
...@@ -90,10 +90,12 @@ EXTERN_C_BEGIN ...@@ -90,10 +90,12 @@ EXTERN_C_BEGIN
REAL(name) = __nacl_irt_##name; REAL(name) = __nacl_irt_##name;
// Switch IRT's pointer to the REAL pointer // Switch IRT's pointer to the REAL pointer
#define USE_REAL(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))REAL(name) #define USE_REAL(name) \
__nacl_irt_##name = (__typeof__(__nacl_irt_##name))REAL(name)
// Switch IRT's pointer to the WRAP function // Switch IRT's pointer to the WRAP function
#define USE_WRAP(name) __nacl_irt_##name = (typeof(__nacl_irt_##name))WRAP(name) #define USE_WRAP(name) \
__nacl_irt_##name = (__typeof__(__nacl_irt_##name))WRAP(name)
#define EXPAND_SYMBOL_LIST_OPERATION(OP) \ #define EXPAND_SYMBOL_LIST_OPERATION(OP) \
OP(chdir); \ OP(chdir); \
......
...@@ -32,18 +32,18 @@ EXTERN_C_BEGIN ...@@ -32,18 +32,18 @@ EXTERN_C_BEGIN
// Declare REAL function pointer. // Declare REAL function pointer.
#define DECLARE_REAL_PTR(group, name) \ #define DECLARE_REAL_PTR(group, name) \
typeof(__libnacl_irt_##group.name) REAL(name); __typeof__(__libnacl_irt_##group.name) REAL(name);
// Assign the REAL function pointer. // Assign the REAL function pointer.
#define ASSIGN_REAL_PTR(group, name) REAL(name) = __libnacl_irt_##group.name; #define ASSIGN_REAL_PTR(group, name) REAL(name) = __libnacl_irt_##group.name;
// Switch IRT's pointer to the REAL pointer // Switch IRT's pointer to the REAL pointer
#define USE_REAL(group, name) \ #define USE_REAL(group, name) \
__libnacl_irt_##group.name = (typeof(REAL(name)))REAL(name); __libnacl_irt_##group.name = (__typeof__(REAL(name)))REAL(name);
// Switch the IRT's pointer to the WRAP function // Switch the IRT's pointer to the WRAP function
#define USE_WRAP(group, name) \ #define USE_WRAP(group, name) \
__libnacl_irt_##group.name = (typeof(REAL(name)))WRAP(name); __libnacl_irt_##group.name = (__typeof__(REAL(name)))WRAP(name);
extern void __libnacl_irt_dev_filename_init(void); extern void __libnacl_irt_dev_filename_init(void);
extern void __libnacl_irt_dev_fdio_init(void); extern void __libnacl_irt_dev_fdio_init(void);
......
...@@ -15,8 +15,10 @@ declare_args() { ...@@ -15,8 +15,10 @@ declare_args() {
if (!use_system_libdrm) { if (!use_system_libdrm) {
config("libdrm_config") { config("libdrm_config") {
# Define _GNU_SOURCE for vasprintf use in xf86drm.c # TODO(thomasanderson): Remove this hack once
defines = [ "_GNU_SOURCE" ] # https://patchwork.kernel.org/patch/10545295/ lands.
defines = [ "typeof(x)=__typeof__(x)" ]
include_dirs = [ include_dirs = [
"src", "src",
"src/include", "src/include",
......
...@@ -16,6 +16,10 @@ if (!use_system_libwayland) { ...@@ -16,6 +16,10 @@ if (!use_system_libwayland) {
"include/protocol", "include/protocol",
"src/src", "src/src",
] ]
# TODO(thomasanderson): Remove this once
# https://patchwork.freedesktop.org/patch/242086/ lands.
cflags = [ "-Wno-macro-redefined" ]
} }
static_library("wayland_util") { static_library("wayland_util") {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment