summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compilerplugins/clang/test/salbool.cxx18
-rw-r--r--solenv/CompilerTest_compilerplugins_clang.mk16
-rw-r--r--solenv/Module_solenv.mk6
-rw-r--r--solenv/gbuild/CompilerTest.mk46
-rw-r--r--solenv/gbuild/LinkTarget.mk9
-rw-r--r--solenv/gbuild/TargetLocations.mk13
-rw-r--r--solenv/gbuild/gbuild.mk1
-rw-r--r--solenv/gbuild/platform/com_GCC_class.mk5
-rw-r--r--solenv/gbuild/platform/com_GCC_defs.mk2
9 files changed, 109 insertions, 7 deletions
diff --git a/compilerplugins/clang/test/salbool.cxx b/compilerplugins/clang/test/salbool.cxx
new file mode 100644
index 000000000000..da861afe73be
--- /dev/null
+++ b/compilerplugins/clang/test/salbool.cxx
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <sal/types.h>
+
+struct S {
+ sal_Bool b; // expected-error {{FieldDecl, use "bool" instead of "sal_Bool" [loplugin:salbool]}}
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk
new file mode 100644
index 000000000000..29fb11a14b21
--- /dev/null
+++ b/solenv/CompilerTest_compilerplugins_clang.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CompilerTest_CompilerTest,compilerplugins_clang))
+
+$(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \
+ compilerplugins/clang/test/salbool \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/solenv/Module_solenv.mk b/solenv/Module_solenv.mk
index 229ee5854425..127007eae676 100644
--- a/solenv/Module_solenv.mk
+++ b/solenv/Module_solenv.mk
@@ -33,4 +33,10 @@ endif
endif
endif
+ifneq ($(COMPILER_PLUGINS),)
+$(eval $(call gb_Module_add_check_targets,solenv, \
+ CompilerTest_compilerplugins_clang \
+))
+endif
+
# vim: set shiftwidth=4 tabstop=4 noexpandtab:
diff --git a/solenv/gbuild/CompilerTest.mk b/solenv/gbuild/CompilerTest.mk
new file mode 100644
index 000000000000..674ec9389d08
--- /dev/null
+++ b/solenv/gbuild/CompilerTest.mk
@@ -0,0 +1,46 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+define gb_CompilerTest_CompilerTest
+$(call gb_CompilerTest__CompilerTest_impl,$(1),$(call gb_CompilerTest_get_linktarget,$(1)))
+
+endef
+
+# call gb_CompilerTest__CompilerTest_impl,compilertest,linktarget
+define gb_CompilerTest__CompilerTest_impl
+$(call gb_LinkTarget_LinkTarget,$(2),CompilerTest_$(1),NONE)
+$(call gb_LinkTarget_get_target,$(2)): COMPILER_TEST := $(true)
+$(call gb_LinkTarget_get_target,$(2)): ENABLE_WERROR := $(true)
+$(call gb_CompilerTest_get_target,$(1)): $(call gb_LinkTarget_get_target,$(2))
+$(call gb_CompilerTest_get_clean_target,$(1)): $(call gb_LinkTarget_get_clean_target,$(2))
+$$(eval $$(call gb_Module_register_target,$(call gb_CompilerTest_get_target,$(1)),$(call gb_CompilerTest_get_clean_target,$(1))))
+$(call gb_Helper_make_userfriendly_targets,$(1),CompilerTest)
+
+endef
+
+define gb_CompilerTest__forward_to_Linktarget
+gb_CompilerTest_$(1) = $$(call gb_LinkTarget_$(1),$$(call gb_CompilerTest_get_linktarget,$$(1)),$$(2),$$(3),CompilerTest_$$(1))
+
+endef
+
+$(eval $(foreach method, \
+ add_cobject \
+ add_cobjects \
+ add_cxxobject \
+ add_cxxobjects \
+ add_exception_objects \
+ add_objcobject \
+ add_objcobjects \
+ add_objcxxobject \
+ add_objcxxobjects \
+, \
+ $(call gb_CompilerTest__forward_to_Linktarget,$(method)) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/LinkTarget.mk b/solenv/gbuild/LinkTarget.mk
index 4e2c2bff5b7c..f54ace62c1d8 100644
--- a/solenv/gbuild/LinkTarget.mk
+++ b/solenv/gbuild/LinkTarget.mk
@@ -135,7 +135,7 @@ $(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%) $(gb
$(call gb_CObject__tool_command,$*,$<)
else
$(call gb_CObject_get_target,%) : $(call gb_CObject_get_source,$(SRCDIR),%)
- $(call gb_Output_announce,$*.c,$(true),C ,3)
+ $(call gb_Output_announce,$*.c,$(true),$(if $(COMPILER_TEST),C? ,C ),3)
$(call gb_CObject__command_pattern,$@,$(T_CFLAGS) $(T_CFLAGS_APPEND),$<,$(call gb_CObject_get_dep_target,$*),$(COMPILER_PLUGINS))
endif
@@ -186,7 +186,7 @@ $(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
$(call gb_CxxObject__tool_command,$*,$<)
else
$(call gb_CxxObject_get_target,%) : $(call gb_CxxObject_get_source,$(SRCDIR),%)
- $(call gb_Output_announce,$*.cxx,$(true),CXX,3)
+ $(call gb_Output_announce,$*.cxx,$(true),$(if $(COMPILER_TEST),C??,CXX),3)
$(eval $(gb_CxxObject__set_pchflags))
$(call gb_CObject__command_pattern,$@,$(T_CXXFLAGS) $(T_CXXFLAGS_APPEND),$<,$(call gb_CxxObject_get_dep_target,$*),$(COMPILER_PLUGINS))
endif
@@ -320,7 +320,7 @@ $(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDI
$(call gb_ObjCxxObject__tool_command,$*,$<)
else
$(call gb_ObjCxxObject_get_target,%) : $(call gb_ObjCxxObject_get_source,$(SRCDIR),%)
- $(call gb_Output_announce,$*.mm,$(true),OCX,3)
+ $(call gb_Output_announce,$*.mm,$(true),$(if $(COMPILER_TEST),O?X,OCX),3)
$(call gb_CObject__command_pattern,$@,$(T_OBJCXXFLAGS) $(T_OBJCXXFLAGS_APPEND),$<,$(call gb_ObjCxxObject_get_dep_target,$*),$(COMPILER_PLUGINS))
endif
@@ -347,7 +347,7 @@ $(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%
$(call gb_ObjCObject__tool_command,$*,$<)
else
$(call gb_ObjCObject_get_target,%) : $(call gb_ObjCObject_get_source,$(SRCDIR),%)
- $(call gb_Output_announce,$*.m,$(true),OCC,3)
+ $(call gb_Output_announce,$*.m,$(true),$(if $(COMPILER_TEST),O?C,OCC),3)
$(call gb_CObject__command_pattern,$@,$(T_OBJCFLAGS) $(T_OBJCFLAGS_APPEND),$<,$(call gb_ObjCObject_get_dep_target,$*),$(COMPILER_PLUGINS))
endif
@@ -614,6 +614,7 @@ $(call gb_LinkTarget_get_target,$(1)) : WARNINGS_NOT_ERRORS :=
$(call gb_LinkTarget_get_target,$(1)) : PLUGIN_WARNINGS_AS_ERRORS :=
$(call gb_LinkTarget_get_target,$(1)) : EXTERNAL_CODE :=
$(call gb_LinkTarget_get_target,$(1)) : SOVERSIONSCRIPT :=
+$(call gb_LinkTarget_get_target,$(1)) : COMPILER_TEST :=
ifeq ($(gb_FULLDEPS),$(true))
ifeq (depcache:,$(filter depcache,$(.FEATURES)):$(gb_PARTIAL_BUILD))
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 3cf0cdf6e606..78ed59c07835 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -44,6 +44,7 @@ gb_CliAssemblyTarget_get_target = $(WORKDIR)/CliAssemblyTarget/$(1).done
gb_CliAssemblyTarget_get_assembly_target = $(WORKDIR)/CliAssemblyTarget/$(1)$(gb_CliAssemblyTarget_POLICYEXT)
gb_CliConfigTarget_get_target = $(WORKDIR)/CliConfigTarget/$(1).config
gb_CliNativeLibrary_get_preparation_target = $(WORKDIR)/CliNativeLibraryTarget/$(1).prepare
+gb_CompilerTest_get_target = $(WORKDIR)/CompilerTest/$(1)
gb_ComponentTarget_get_target = $(WORKDIR)/ComponentTarget/$(1).component
gb_ComponentTarget_get_target_for_build = $(WORKDIR_FOR_BUILD)/ComponentTarget/$(1).component
gb_Configuration_get_preparation_target = $(WORKDIR)/Configuration/$(1).prepared
@@ -233,6 +234,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
CliLibrary \
CliNativeLibrary \
CliUnoApi \
+ CompilerTest \
ComponentTarget \
CustomPackage \
DescriptionTranslateTarget \
@@ -411,6 +413,17 @@ define gb_CppunitTest_get_linktarget
$(call gb_CppunitTest__get_workdir_linktargetname,$(1))<>$(call gb_CppunitTest__get_linktarget_target,$(1))
endef
+define gb_CompilerTest__get_workdir_linktargetname
+CompilerTest/$(1)
+endef
+define gb_CompilerTest__get_linktarget_target
+$(WORKDIR)/LinkTarget/$(call gb_CompilerTest__get_workdir_linktargetname,$(1))
+endef
+# this returns a tuple of both the linktargetname, and the target file
+define gb_CompilerTest_get_linktarget
+$(call gb_CompilerTest__get_workdir_linktargetname,$(1))<>$(call gb_CompilerTest__get_linktarget_target,$(1))
+endef
+
# static members declared here because they are used globally
gb_StaticLibrary_WORKDIR = $(WORKDIR)/LinkTarget/StaticLibrary
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index f98ce8185899..f05310706742 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -313,6 +313,7 @@ include $(foreach class, \
AutoInstall \
PackageSet \
GeneratedPackage \
+ CompilerTest \
,$(GBUILDDIR)/$(class).mk)
$(eval $(call gb_Helper_process_executable_registrations))
diff --git a/solenv/gbuild/platform/com_GCC_class.mk b/solenv/gbuild/platform/com_GCC_class.mk
index 4d0378bec617..3967e200981f 100644
--- a/solenv/gbuild/platform/com_GCC_class.mk
+++ b/solenv/gbuild/platform/com_GCC_class.mk
@@ -54,15 +54,16 @@ $(call gb_Helper_abbreviate_dirs,\
$(if $(VISIBILITY),,$(gb_VISIBILITY_FLAGS)) \
$(if $(WARNINGS_NOT_ERRORS),$(if $(ENABLE_WERROR),$(if $(PLUGIN_WARNINGS_AS_ERRORS),$(gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS))),$(gb_CFLAGS_WERROR)) \
$(if $(5),$(gb_COMPILER_PLUGINS)) \
+ $(if $(COMPILER_TEST),-fsyntax-only -Xclang -verify) \
$(2) \
$(if $(EXTERNAL_CODE),$(gb_CXXFLAGS_Wundef),$(gb_DEFS_INTERNAL)) \
-c $(3) \
-o $(1) \
- $(call gb_cxx_dep_generation_options,$(1),$(4)) \
+ $(if $(COMPILER_TEST),,$(call gb_cxx_dep_generation_options,$(1),$(4))) \
-I$(dir $(3)) \
$(INCLUDE) \
$(PCHFLAGS) \
- $(call gb_cxx_dep_copy,$(4)) \
+ $(if $(COMPILER_TEST),,$(call gb_cxx_dep_copy,$(4))) \
)
endef
diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk
index 2d6dc73d4a6f..6b697fc9461c 100644
--- a/solenv/gbuild/platform/com_GCC_defs.mk
+++ b/solenv/gbuild/platform/com_GCC_defs.mk
@@ -126,7 +126,7 @@ gb_CXXFLAGS_COMMON += -fpch-preprocess -Winvalid-pch
endif
endif
-gb_CFLAGS_WERROR := $(if $(ENABLE_WERROR),-Werror)
+gb_CFLAGS_WERROR = $(if $(ENABLE_WERROR),-Werror)
# This is the default in non-C++11 mode
ifeq ($(COM_IS_CLANG),TRUE)