Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2846

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/46/2846/1

use -isystem instead of -I for 3rd party headers

This should avoid gcc warnings in external code we don't care about,
so there'll be no need to fix them for WaE.

Change-Id: I629dc2672c075908294609249183f27ad2984325
---
M RepositoryExternal.mk
M config_host.mk.in
M configure.ac
3 files changed, 64 insertions(+), 43 deletions(-)



diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index a7042b1..75b862d 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -99,7 +99,7 @@
 define gb_LinkTarget__use_npapi_headers
 $(call gb_LinkTarget_use_package,$(1),npapi)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(OUTDIR)/inc/external/npsdk \
+       $(ISYSTEM)$(OUTDIR)/inc/external/npsdk \
        $$(INCLUDE) \
 )
 
@@ -134,7 +134,7 @@
 define gb_LinkTarget__use_vigra_headers
 $(call gb_LinkTarget_use_unpacked,$(1),vigra)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,vigra/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,vigra/include) \
        $$(INCLUDE) \
 )
 
@@ -151,7 +151,7 @@
 define gb_LinkTarget__use_mdds_headers
 $(call gb_LinkTarget_use_unpacked,$(1),mdds)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,mdds/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,mdds/include) \
        $$(INCLUDE) \
 )
 
@@ -203,7 +203,7 @@
     cppunit \
 )
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,cppunit/include)\
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,cppunit/include)\
        $$(INCLUDE) \
 )
 
@@ -274,8 +274,8 @@
 )
 
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,mysqlcppconn) \
-       -I$(call gb_UnpackedTarball_get_dir,mysqlcppconn)/cppconn \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,mysqlcppconn) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,mysqlcppconn)/cppconn \
        $$(INCLUDE) \
 )
 
@@ -315,7 +315,7 @@
 )
 
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(OUTDIR)/inc/external/zlib \
+       $(ISYSTEM)system $(OUTDIR)/inc/external/zlib \
        $$(INCLUDE) \
 )
 
@@ -363,7 +363,7 @@
 define gb_LinkTarget__use_jpeg
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(OUTDIR)/inc/external/jpeg \
+       $(ISYSTEM)system $(OUTDIR)/inc/external/jpeg \
 )
 
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -430,7 +430,7 @@
 $(if $(2),,$(error gb_LinkTarget__use_expat needs additional parameter))
 
 $(call gb_LinkTarget_set_include,$(1),\
-    -I$(OUTDIR)/inc/external/expat \
+    $(ISYSTEM)$(OUTDIR)/inc/external/expat \
     $$(INCLUDE) \
 )
 
@@ -481,7 +481,7 @@
 define gb_LinkTarget__use_hyphen
 $(call gb_LinkTarget_use_unpacked,$(1),hyphen)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,hyphen)\
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,hyphen)\
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -515,7 +515,7 @@
 )
 $(call gb_LinkTarget_use_unpacked,$(1),hunspell)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,hunspell/src/hunspell)\
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,hunspell/src/hunspell)\
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -592,7 +592,7 @@
 define gb_LinkTarget__use_boost_headers
 $(call gb_LinkTarget_use_unpacked,$(1),boost)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,boost) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,boost) \
        $$(INCLUDE) \
 )
 
@@ -673,7 +673,7 @@
 )
 
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,exttextcat/src) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,exttextcat/src) \
        $$(INCLUDE) \
 )
 
@@ -710,7 +710,7 @@
 )
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(call gb_UnpackedTarball_get_dir,xml2)/include \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xml2)/include \
 )
 
 endef
@@ -754,7 +754,7 @@
 $(call gb_LinkTarget_use_package,$(1),xslt)
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(call gb_UnpackedTarball_get_dir,xslt) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xslt) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),\
        xslt \
@@ -766,7 +766,7 @@
 $(call gb_LinkTarget_use_package,$(1),xslt)
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(call gb_UnpackedTarball_get_dir,xslt) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xslt) \
 )
 
 $(call gb_LinkTarget_use_libraries,$(1),\
@@ -804,7 +804,7 @@
 define gb_LinkTarget__use_liblangtag
 $(call gb_LinkTarget_use_unpacked,$(1),langtag)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,langtag) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,langtag) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -842,7 +842,7 @@
 define gb_LinkTarget__use_neon
 $(call gb_LinkTarget_use_unpacked,$(1),neon)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,neon/src) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,neon/src) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),\
@@ -878,7 +878,7 @@
 
 define gb_LinkTarget__use_redland_headers
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,redland)/librdf \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,redland)/librdf \
        $$(INCLUDE) \
 )
 
@@ -886,7 +886,7 @@
 
 define gb_LinkTarget__use_raptor_headers
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,raptor)/src \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,raptor)/src \
        $$(INCLUDE) \
 )
 
@@ -894,7 +894,7 @@
 
 define gb_LinkTarget__use_rasqal_headers
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,rasqal)/src \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,rasqal)/src \
        $$(INCLUDE) \
 )
 
@@ -968,8 +968,8 @@
 $(call gb_LinkTarget_use_package,$(1),cairo)
 $(call gb_LinkTarget_use_package,$(1),pixman)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,cairo) \
-       -I$(call gb_UnpackedTarball_get_dir,cairo)/src \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,cairo) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,cairo)/src \
        $(FREETYPE_CFLAGS) \
        $$(INCLUDE) \
 )
@@ -1031,7 +1031,7 @@
 define gb_LinkTarget__use_graphite
 $(call gb_LinkTarget_use_unpacked,$(1),graphite)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,graphite/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,graphite/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -1083,7 +1083,7 @@
 define gb_LinkTarget__use_icu_headers
 $(call gb_LinkTarget_use_package,$(1),icu)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(OUTDIR)/inc/external \
+       $(ISYSTEM)$(OUTDIR)/inc/external \
        $$(INCLUDE) \
 )
 
@@ -1203,7 +1203,7 @@
 
 define gb_LinkTarget__use_openssl_headers
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,openssl)/include \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,openssl)/include \
        $$(INCLUDE) \
 )
 
@@ -1487,7 +1487,7 @@
 define gb_LinkTarget__use_lcms2
 $(call gb_LinkTarget_use_package,$(1),lcms2)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,lcms2/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,lcms2/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),\
@@ -1505,7 +1505,7 @@
 define gb_LinkTarget__use_lcms2
 $(call gb_LinkTarget_use_package,$(1),lcms2)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,lcms2/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,lcms2/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),\
@@ -1540,7 +1540,7 @@
        lpsolve55 \
 )
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,lpsolve) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,lpsolve) \
        $$(INCLUDE) \
 )
 
@@ -1751,7 +1751,7 @@
 define gb_LinkTarget__use_curl
 $(call gb_LinkTarget_use_package,$(1),curl)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,curl/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,curl/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_libraries,$(1),\
@@ -1814,9 +1814,9 @@
 $(call gb_LinkTarget_use_package,$(1),xpdf)
 
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,xpdf) \
-       -I$(call gb_UnpackedTarball_get_dir,xpdf)/xpdf \
-       -I$(call gb_UnpackedTarball_get_dir,xpdf)/goo \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xpdf) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xpdf)/xpdf \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,xpdf)/goo \
        $$(INCLUDE) \
 )
 
@@ -1927,7 +1927,7 @@
 define gb_LinkTarget__use_openldap
 $(call gb_LinkTarget_use_unpacked,$(1),openldap)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,openldap/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,openldap/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_package,$(1),openldap)
@@ -1969,7 +1969,7 @@
 )
 
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(OUTDIR)/inc/postgresql \
+       $(ISYSTEM)$(OUTDIR)/inc/postgresql \
        $$(INCLUDE) \
 )
 
@@ -2004,7 +2004,7 @@
 
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(OUTDIR)/inc/mozilla \
+       $(ISYSTEM)$(OUTDIR)/inc/mozilla \
 )
 
 $(call gb_LinkTarget_use_libraries,$(1),\
@@ -2220,9 +2220,9 @@
 $(call gb_LinkTarget_use_package,$(1),python3)
 $(call gb_LinkTarget_use_external_project,$(1),python3)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,python3) \
-       -I$(call gb_UnpackedTarball_get_dir,python3)/PC \
-       -I$(call gb_UnpackedTarball_get_dir,python3)/Include \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,python3) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,python3)/PC \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,python3)/Include \
        $$(INCLUDE) \
 )
 
@@ -2276,7 +2276,7 @@
 define gb_LinkTarget__use_orcus
 $(call gb_LinkTarget_use_unpacked,$(1),orcus)
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(call gb_UnpackedTarball_get_dir,orcus/include) \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,orcus/include) \
        $$(INCLUDE) \
 )
 $(call gb_LinkTarget_use_static_libraries,$(1),orcus)
@@ -2403,8 +2403,8 @@
 $(call gb_LinkTarget_use_package,$(1),nss)
 $(call gb_LinkTarget_set_include,$(1),\
        $$(INCLUDE) \
-       -I$(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/public/nss \
-       -I$(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/out/include \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/public/nss \
+       $(ISYSTEM)$(call gb_UnpackedTarball_get_dir,nss)/mozilla/dist/out/include \
 )
 
 $(call gb_LinkTarget_use_libraries,$(1),\
diff --git a/config_host.mk.in b/config_host.mk.in
index 496097c..5e68b41 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -252,6 +252,7 @@
 export INSTALLDIR=@INSTALLDIR@
 export INSTALLDIRNAME=@INSTALLDIRNAME@
 export INTRO_BITMAP=@INTRO_BITMAP@
+export ISYSTEM=@ISYSTEM@
 export JAVACISGCJ=@JAVACISGCJ@
 export JAVACISKAFFE=@JAVACISKAFFE@
 export JAVACOMPILER=@JAVACOMPILER@
diff --git a/configure.ac b/configure.ac
index 1492d72..2c2b45d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2830,6 +2830,26 @@
 fi
 AC_SUBST(HAVE_LD_BSYMBOLIC_FUNCTIONS)
 
+# Use -isystem (gcc) if possible, to avoid warnigs in 3rd party headers.
+ISYSTEM=
+if test "$GCC" = "yes"; then
+    AC_MSG_CHECKING( for -isystem )
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS -Werror -finline-limit=0"
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ ISYSTEM=-isystem ],[])
+    CFLAGS=$save_CFLAGS
+    if test -n "$ISYSTEM"; then
+        AC_MSG_RESULT(yes)
+    else
+        AC_MSG_RESULT(no)
+    fi
+fi
+if test -z "$ISYSTEM"; then
+    # fall back to using -I
+    ISYSTEM=-I
+fi
+AC_SUBST(ISYSTEM)
+
 dnl ===================================================================
 dnl  Check which Visual Studio or MinGW compiler is used
 dnl ===================================================================
@@ -3901,7 +3921,7 @@
     WORKDIR=${BUILDDIR}/workdir/${INPATH}
 fi
 OUTDIR="${SOLARVER}/${INPATH}"
-SOLARINC="-I. -I${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc -I$SRC_ROOT/solenv/inc 
$SOLARINC"
+SOLARINC="-I. ${ISYSTEM}${SOLARVER}/$INPATH/inc/external -I${SOLARVER}/$INPATH/inc 
-I$SRC_ROOT/solenv/inc $SOLARINC"
 AC_SUBST(COM)
 AC_SUBST(CPU)
 AC_SUBST(CPUNAME)

-- 
To view, visit https://gerrit.libreoffice.org/2846
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I629dc2672c075908294609249183f27ad2984325
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Luboš Luňák <l.lunak@suse.cz>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.