Title: [154008] trunk
Revision
154008
Author
[email protected]
Date
2013-08-13 09:58:17 -0700 (Tue, 13 Aug 2013)

Log Message

[Autotools] Unicode's CFLAGS enforce -D_FORTIFY_SOURCE=2, -D_REENTRANT=1, causing faulty Clang builds
https://bugs.webkit.org/show_bug.cgi?id=119685

Reviewed by Gustavo Noronha Silva.

icu-config includes '-D_FORTIFY_SOURCE=2 -D_REENTRANT=1' when printing out C preprocessor flags that are used
as the C compiler flags to avoid other unwanted compiler options. This causes problems when building optimized
builds with Clang because of a bug in that compiler:
http://llvm.org/bugs/show_bug.cgi?id=16821

To avoid that, the C preprocessor search flags, as printed by `icu-config --cppflags-searchpath` are now used
the Unicode dependency's C compiler flags, avoiding unconditionally specifying the two macros.

To adjust for that, the `-pthread` flag is added to the global CFLAGS and CXXFLAGS variables, ensuring
the _REENTRANT define is set to 1 and declaring the flag globally instead of relying on Glib dependency's
C compiler flags to do so for us. -D_FORTIFY_SOURCE=2 is only added to the CFLAGS and CXXFLAGS variables if
the compiler in use is gcc or g++, preventing the Clang builds to malfunction.

* Source/autotools/FindDependencies.m4:
* Source/autotools/SetupCompilerFlags.m4:

Modified Paths

Diff

Modified: trunk/ChangeLog (154007 => 154008)


--- trunk/ChangeLog	2013-08-13 16:56:04 UTC (rev 154007)
+++ trunk/ChangeLog	2013-08-13 16:58:17 UTC (rev 154008)
@@ -1,5 +1,28 @@
 2013-08-13  Zan Dobersek  <[email protected]>
 
+        [Autotools] Unicode's CFLAGS enforce -D_FORTIFY_SOURCE=2, -D_REENTRANT=1, causing faulty Clang builds
+        https://bugs.webkit.org/show_bug.cgi?id=119685
+
+        Reviewed by Gustavo Noronha Silva.
+
+        icu-config includes '-D_FORTIFY_SOURCE=2 -D_REENTRANT=1' when printing out C preprocessor flags that are used
+        as the C compiler flags to avoid other unwanted compiler options. This causes problems when building optimized
+        builds with Clang because of a bug in that compiler:
+        http://llvm.org/bugs/show_bug.cgi?id=16821
+
+        To avoid that, the C preprocessor search flags, as printed by `icu-config --cppflags-searchpath` are now used
+        the Unicode dependency's C compiler flags, avoiding unconditionally specifying the two macros.
+
+        To adjust for that, the `-pthread` flag is added to the global CFLAGS and CXXFLAGS variables, ensuring
+        the _REENTRANT define is set to 1 and declaring the flag globally instead of relying on Glib dependency's
+        C compiler flags to do so for us. -D_FORTIFY_SOURCE=2 is only added to the CFLAGS and CXXFLAGS variables if
+        the compiler in use is gcc or g++, preventing the Clang builds to malfunction.
+
+        * Source/autotools/FindDependencies.m4:
+        * Source/autotools/SetupCompilerFlags.m4:
+
+2013-08-13  Zan Dobersek  <[email protected]>
+
         [Autotools] Don't compare $CC, $CXX to exact compiler names
         https://bugs.webkit.org/show_bug.cgi?id=119683
 

Modified: trunk/Source/autotools/FindDependencies.m4 (154007 => 154008)


--- trunk/Source/autotools/FindDependencies.m4	2013-08-13 16:56:04 UTC (rev 154007)
+++ trunk/Source/autotools/FindDependencies.m4	2013-08-13 16:58:17 UTC (rev 154008)
@@ -125,7 +125,7 @@
 
         # We don't use --cflags as this gives us a lot of things that we don't necessarily want,
         # like debugging and optimization flags. See man (1) icu-config for more info.
-        UNICODE_CFLAGS=`$icu_config --cppflags`
+        UNICODE_CFLAGS=`$icu_config --cppflags-searchpath`
         UNICODE_LIBS=`$icu_config --ldflags-libsonly`
         ;;
 esac

Modified: trunk/Source/autotools/SetupCompilerFlags.m4 (154007 => 154008)


--- trunk/Source/autotools/SetupCompilerFlags.m4	2013-08-13 16:56:04 UTC (rev 154007)
+++ trunk/Source/autotools/SetupCompilerFlags.m4	2013-08-13 16:58:17 UTC (rev 154008)
@@ -1,7 +1,7 @@
 # Use C99 as the language standard for C code.
-CFLAGS="$CFLAGS -std=c99"
+CFLAGS="$CFLAGS -pthread -std=c99"
 # Use the C++11 standard. Do not warn about C++11 incompatibilities.
-CXXFLAGS="$CXXFLAGS -std=c++11 -Wno-c++11-compat"
+CXXFLAGS="$CXXFLAGS -pthread -std=c++11 -Wno-c++11-compat"
 
 # Clang requires suppression of unused arguments warnings.
 if test "$c_compiler" = "clang"; then
@@ -15,6 +15,13 @@
     CXXFLAGS="$CXXFLAGS -stdlib=libstdc++ -Wno-c++11-extensions -Qunused-arguments"
 fi
 
+if test "$c_compiler" = "gcc"; then
+    CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+fi
+if test "$cxx_compiler" = "g++"; then
+    CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+fi
+
 if test "$host_cpu" = "sh4"; then
     CXXFLAGS="$CXXFLAGS -mieee -w"
     CFLAGS="$CFLAGS -mieee -w"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to