Rafaël Carré
2013-Nov-20 11:16 UTC
[flac-dev] [PATCH 1/2] Revert "configure.ac : If gcc is version 4.2, use -fgnu89-inline."
This reverts commit 2860f1780ca92c779ee0a2c545ae1b9c4818dc53. Conflicts: configure.ac Do not use -fgnu89-inline as it can emit duplicate symbols for inline functions that are declared in multiple object files being linked together. For example on clang 5.0 targetting iOS (clang advertises itself as gcc 4.2, the last GPL version of gcc) --- configure.ac | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 7f63a04..fa6f4fb 100644 --- a/configure.ac +++ b/configure.ac @@ -396,7 +396,7 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then if test x$enable_gcc_werror = "xyes" ; then CFLAGS="$CFLAGS -Werror " CXXFLAGS="$CXXFLAGS -Werror " - fi + fi XIPH_ADD_CFLAGS([-Wdeclaration-after-statement]) XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2]) @@ -409,18 +409,14 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" CFLAGS="$CFLAGS -fvisibility=hidden" CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - fi - - if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then - XIPH_ADD_CFLAGS([-fgnu89-inline]) - fi + fi if test "x$asm_optimisation" = "xyes" ; then XIPH_ADD_CFLAGS([-msse2]) - fi - fi +fi + XIPH_ADD_CFLAGS([-Wextra]) if test x$enable_stack_smash_protection = "xyes" ; then -- 1.8.3.4 (Apple Git-47)
Rafaël Carré
2013-Nov-20 11:16 UTC
[flac-dev] [PATCH 2/2] Use -fvisibility for osx targets too
--- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fa6f4fb..19306ed 100644 --- a/configure.ac +++ b/configure.ac @@ -405,7 +405,7 @@ if test x$ac_cv_c_compiler_gnu = xyes ; then XIPH_ADD_CXXFLAGS([-Weffc++]) AC_LANG_POP([C++]) - if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then + if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf -o "$OBJ_FORMAT" = macho; then CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" CFLAGS="$CFLAGS -fvisibility=hidden" CXXFLAGS="$CXXFLAGS -fvisibility=hidden" -- 1.8.3.4 (Apple Git-47)
Erik de Castro Lopo
2013-Nov-20 20:28 UTC
[flac-dev] [PATCH 1/2] Revert "configure.ac : If gcc is version 4.2, use -fgnu89-inline."
Rafa?l Carr? wrote:> This reverts commit 2860f1780ca92c779ee0a2c545ae1b9c4818dc53. > > Conflicts: > configure.ac > > Do not use -fgnu89-inline as it can emit duplicate symbols for > inline functions that are declared in multiple object files > being linked together. > > For example on clang 5.0 targetting iOS > (clang advertises itself as gcc 4.2, the last GPL version of gcc)Ah yes, I hit this problem in another project. However I came up with a better solution, to detect the difference between GCC and Clang. I'll port that fix over to FLAC in the next couple of days. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo
2013-Nov-20 20:30 UTC
[flac-dev] [PATCH 1/2] Revert "configure.ac : If gcc is version 4.2, use -fgnu89-inline."
Erik de Castro Lopo wrote:> Rafa?l Carr? wrote: > > > This reverts commit 2860f1780ca92c779ee0a2c545ae1b9c4818dc53. > > > > Conflicts: > > configure.ac > > > > Do not use -fgnu89-inline as it can emit duplicate symbols for > > inline functions that are declared in multiple object files > > being linked together. > > > > For example on clang 5.0 targetting iOS > > (clang advertises itself as gcc 4.2, the last GPL version of gcc) > > Ah yes, I hit this problem in another project. However I came up > with a better solution, to detect the difference between GCC and > Clang. I'll port that fix over to FLAC in the next couple of days.The fact that Apple/Clang compiler advertises itself as being GCC, but diverges from the actual behaviour of GCC is breaking software all over the internet. I hope the Apple/Clang people learn from this mistake. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/
Erik de Castro Lopo
2013-Nov-22 07:16 UTC
[flac-dev] [PATCH 1/2] Revert "configure.ac : If gcc is version 4.2, use -fgnu89-inline."
Erik de Castro Lopo wrote:> Ah yes, I hit this problem in another project. However I came up > with a better solution, to detect the difference between GCC and > Clang. I'll port that fix over to FLAC in the next couple of days.My latest commit below. Please test. Cheers, Erik commit a6a4b6f2052829c205319ecb0f5df553baedc9a4 Author: Erik de Castro Lopo <erikd at mega-nerd.com> Date: Fri Nov 22 18:13:36 2013 +1100 Detect Clang masquerading as GCC. Autoconf detects the Clang compiler as GNU GCC (clang sets defines like __GNUC__ etc) but Clang is *not* completely compatible. If we detect Clang we set ac_vc_c_compiler_gnu to 'no'. M configure.ac A m4/clang.m4 A m4/really_gcc.m4 -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/