summaryrefslogtreecommitdiff
path: root/unodevtools
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /unodevtools
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'unodevtools')
-rw-r--r--unodevtools/source/skeletonmaker/cppcompskeleton.cxx24
-rw-r--r--unodevtools/source/skeletonmaker/cpptypemaker.cxx18
-rw-r--r--unodevtools/source/skeletonmaker/javacompskeleton.cxx30
-rw-r--r--unodevtools/source/skeletonmaker/javatypemaker.cxx18
-rw-r--r--unodevtools/source/skeletonmaker/skeletoncommon.cxx14
5 files changed, 52 insertions, 52 deletions
diff --git a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
index 0fba9d46ab14..75da490435e7 100644
--- a/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/cppcompskeleton.cxx
@@ -31,7 +31,7 @@ using namespace ::codemaker::cpp;
namespace skeletonmaker { namespace cpp {
-void generateIncludes(std::ostream & o,
+static void generateIncludes(std::ostream & o,
const std::set< OUString >& interfaces,
const OUString & propertyhelper, const bool serviceobject,
const bool supportxcomponent)
@@ -67,7 +67,7 @@ void generateIncludes(std::ostream & o,
}
}
-short generateNamespace(std::ostream & o,
+static short generateNamespace(std::ostream & o,
const OString & implname,
bool serviceobject,
OString & nm)
@@ -112,7 +112,7 @@ short generateNamespace(std::ostream & o,
return count;
}
-OString generateCompHelperDeclaration(std::ostream & o,
+static OString generateCompHelperDeclaration(std::ostream & o,
const OString & implname)
{
OString nm;
@@ -137,7 +137,7 @@ OString generateCompHelperDeclaration(std::ostream & o,
return nm;
}
-void generateCompHelperDefinition(std::ostream & o,
+static void generateCompHelperDefinition(std::ostream & o,
const OString & implname,
const OString & classname,
const std::set< OUString >& services)
@@ -176,7 +176,7 @@ void generateCompHelperDefinition(std::ostream & o,
}
-void generateCompFunctions(std::ostream & o, const OString & nmspace)
+static void generateCompFunctions(std::ostream & o, const OString & nmspace)
{
o << "static ::cppu::ImplementationEntry const entries[] = {\n"
" { &" << nmspace << "::_create,\n &"
@@ -500,7 +500,7 @@ void generateXDispatchProvider(std::ostream& o,
" }\n\n return lDispatcher;\n}\n\n";
}
-void generateAddinConstructorAndHelper(std::ostream& o,
+static void generateAddinConstructorAndHelper(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager, const OString & classname,
const std::set< OUString >& interfaces)
@@ -574,7 +574,7 @@ void generateAddinConstructorAndHelper(std::ostream& o,
o <<"}\n\n";
}
-void generateMemberInitialization(std::ostream& o,
+static void generateMemberInitialization(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
AttributeInfo const & members)
@@ -596,7 +596,7 @@ void generateMemberInitialization(std::ostream& o,
}
}
-void generateMemberDeclaration(std::ostream& o,
+static void generateMemberDeclaration(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
AttributeInfo const & members)
@@ -610,7 +610,7 @@ void generateMemberDeclaration(std::ostream& o,
}
}
-OString generateClassDefinition(std::ostream& o,
+static OString generateClassDefinition(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
OString const & classname,
@@ -843,7 +843,7 @@ OString generateClassDefinition(std::ostream& o,
return parentname.makeStringAndClear();
}
-void generateXServiceInfoBodies(std::ostream& o,
+static void generateXServiceInfoBodies(std::ostream& o,
OString const & classname,
OString const & comphelpernamespace)
{
@@ -868,7 +868,7 @@ void generateXServiceInfoBodies(std::ostream& o,
}
-void generateMethodBodies(std::ostream& o,
+static void generateMethodBodies(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
std::set< OUString > const & interfaces,
@@ -891,7 +891,7 @@ void generateMethodBodies(std::ostream& o,
}
}
-void generateQueryInterface(std::ostream& o,
+static void generateQueryInterface(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
const std::set< OUString >& interfaces,
diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
index 47d5e4aa0907..05ca099998cc 100644
--- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx
@@ -30,7 +30,7 @@ using namespace ::codemaker::cpp;
namespace skeletonmaker { namespace cpp {
-void printType(
+static void printType(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank,
@@ -134,7 +134,7 @@ void printType(
referenceType, defaultvalue);
}
-bool printConstructorParameters(
+static bool printConstructorParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
@@ -268,7 +268,7 @@ bool printConstructorParameters(
return previous;
}
-void printConstructor(
+static void printConstructor(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
@@ -281,7 +281,7 @@ void printConstructor(
o << ");\n";
}
-void printMethodParameters(
+static void printMethodParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
std::vector< unoidl::InterfaceTypeEntity::Method::Parameter > const &
@@ -311,7 +311,7 @@ void printMethodParameters(
}
}
-void printExceptionSpecification(
+static void printExceptionSpecification(
std::ostream & o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
@@ -328,7 +328,7 @@ void printExceptionSpecification(
o << ")";
}
-void printSetPropertyMixinBody(
+static void printSetPropertyMixinBody(
std::ostream & o, unoidl::InterfaceTypeEntity::Attribute const & attribute)
{
unoidl::AccumulationBasedServiceEntity::Property::Attributes propFlags
@@ -652,7 +652,7 @@ void printMethods(std::ostream & o,
o << "\n";
}
-void printConstructors(
+static void printConstructors(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager, OUString const & name)
{
@@ -700,7 +700,7 @@ void printConstructors(
}
}
-void printServiceMembers(
+static void printServiceMembers(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
OUString const & name,
@@ -739,7 +739,7 @@ void printServiceMembers(
}
}
-void printMapsToCppType(
+static void printMapsToCppType(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank,
diff --git a/unodevtools/source/skeletonmaker/javacompskeleton.cxx b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
index 75176befcea3..be3bfe7fe751 100644
--- a/unodevtools/source/skeletonmaker/javacompskeleton.cxx
+++ b/unodevtools/source/skeletonmaker/javacompskeleton.cxx
@@ -32,14 +32,14 @@ using namespace ::codemaker::java;
namespace skeletonmaker { namespace java {
-void generatePackage(std::ostream & o, const OString & implname)
+static void generatePackage(std::ostream & o, const OString & implname)
{
sal_Int32 index = implname.lastIndexOf('.');
if (index != -1)
o << "package " << implname.copy(0, index) << ";\n\n";
}
-void generateImports(std::ostream & o, ProgramOptions const & options,
+static void generateImports(std::ostream & o, ProgramOptions const & options,
const OUString & propertyhelper,
bool serviceobject, bool supportxcomponent)
{
@@ -73,7 +73,7 @@ void generateImports(std::ostream & o, ProgramOptions const & options,
}
}
-void generateCompFunctions(std::ostream & o, const OString & classname)
+static void generateCompFunctions(std::ostream & o, const OString & classname)
{
o << " public static XSingleComponentFactory __getComponentFactory("
" String sImplementationName ) {\n"
@@ -91,7 +91,7 @@ void generateCompFunctions(std::ostream & o, const OString & classname)
" }\n\n";
}
-void generateXServiceInfoBodies(std::ostream& o)
+static void generateXServiceInfoBodies(std::ostream& o)
{
o << " // com.sun.star.lang.XServiceInfo:\n";
o << " public String getImplementationName() {\n"
@@ -186,7 +186,7 @@ void generateXPropertyAccessBodies(std::ostream& o)
}
-bool checkAttribute(
+static bool checkAttribute(
OStringBuffer& attributeValue,
unoidl::AccumulationBasedServiceEntity::Property::Attributes attribute)
{
@@ -249,7 +249,7 @@ bool checkAttribute(
return cast;
}
-void registerProperties(std::ostream& o,
+static void registerProperties(std::ostream& o,
const AttributeInfo& properties,
const OString& indentation)
{
@@ -277,7 +277,7 @@ void registerProperties(std::ostream& o,
}
}
-void generateXLocalizableBodies(std::ostream& o) {
+static void generateXLocalizableBodies(std::ostream& o) {
// com.sun.star.lang.XLocalizable:
// setLocale
o << " // com.sun.star.lang.XLocalizable:\n"
@@ -289,7 +289,7 @@ void generateXLocalizableBodies(std::ostream& o) {
" return m_locale;\n }\n\n";
}
-void generateXAddInBodies(std::ostream& o)
+static void generateXAddInBodies(std::ostream& o)
{
// com.sun.star.sheet.XAddIn:
// getProgrammaticFuntionName
@@ -357,7 +357,7 @@ void generateXAddInBodies(std::ostream& o)
"sCATEGORYDISPLAYNAME);\n }\n\n";
}
-void generateXCompatibilityNamesBodies(std::ostream& o)
+static void generateXCompatibilityNamesBodies(std::ostream& o)
{
o << " // com.sun.star.sheet.XCompatibilityNames:\n"
" public com.sun.star.sheet.LocalizedName[] getCompatibilityNames("
@@ -407,7 +407,7 @@ void generateXCompatibilityNamesBodies(std::ostream& o)
" return seqLocalizedNames;\n }\n\n";
}
-void generateXInitializationBodies(std::ostream& o)
+static void generateXInitializationBodies(std::ostream& o)
{
o << " // com.sun.star.lang.XInitialization:\n"
" public void initialize( Object[] object )\n"
@@ -417,7 +417,7 @@ void generateXInitializationBodies(std::ostream& o)
" com.sun.star.frame.XFrame.class, object[0]);\n }\n }\n\n";
}
-void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options)
+static void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options)
{
// com.sun.star.frame.XDispatch
// dispatch
@@ -453,7 +453,7 @@ void generateXDispatchBodies(std::ostream& o, ProgramOptions const & options)
" // add your own code here\n }\n\n";
}
-void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & options)
+static void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & options)
{
// com.sun.star.frame.XDispatchProvider
// queryDispatch
@@ -492,7 +492,7 @@ void generateXDispatchProviderBodies(std::ostream& o, ProgramOptions const & opt
" }\n return seqDispatcher;\n }\n\n";
}
-void generateMethodBodies(std::ostream& o,
+static void generateMethodBodies(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
const std::set< OUString >& interfaces,
@@ -562,7 +562,7 @@ static const char* const propcomment=
" // Ensure that your attributes are initialized correctly!\n";
-void generateAddinConstructorAndHelper(std::ostream& o,
+static void generateAddinConstructorAndHelper(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager, const OString & classname,
const std::set< OUString >& services,
@@ -699,7 +699,7 @@ void generateAddinConstructorAndHelper(std::ostream& o,
}
-void generateClassDefinition(std::ostream& o,
+static void generateClassDefinition(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
const OString & classname,
diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx
index 64917b95cf7d..3c45fc209b1f 100644
--- a/unodevtools/source/skeletonmaker/javatypemaker.cxx
+++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx
@@ -30,7 +30,7 @@
namespace skeletonmaker { namespace java {
-void printType(
+static void printType(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank,
@@ -123,7 +123,7 @@ void printType(
defaultvalue);
}
-bool printConstructorParameters(
+static bool printConstructorParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
@@ -257,7 +257,7 @@ bool printConstructorParameters(
return previous;
}
-void printConstructor(
+static void printConstructor(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort,
@@ -270,7 +270,7 @@ void printConstructor(
o << ");\n";
}
-void printMethodParameters(
+static void printMethodParameters(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
std::vector< unoidl::InterfaceTypeEntity::Method::Parameter > const &
@@ -298,7 +298,7 @@ void printMethodParameters(
}
}
-void printExceptionSpecification(
+static void printExceptionSpecification(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
std::vector< OUString > const & exceptions)
@@ -317,7 +317,7 @@ void printExceptionSpecification(
}
-void printSetPropertyMixinBody(
+static void printSetPropertyMixinBody(
std::ostream & o, unoidl::InterfaceTypeEntity::Attribute const & attribute,
OString const & indentation)
{
@@ -570,7 +570,7 @@ void printMethods(std::ostream & o,
}
}
-void printConstructors(
+static void printConstructors(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager, OUString const & name)
{
@@ -619,7 +619,7 @@ void printConstructors(
}
}
-void printServiceMembers(
+static void printServiceMembers(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
OUString const & name,
@@ -655,7 +655,7 @@ void printServiceMembers(
}
}
-void printMapsToJavaType(
+static void printMapsToJavaType(
std::ostream & o, ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
codemaker::UnoType::Sort sort, OUString const & nucleus, sal_Int32 rank,
diff --git a/unodevtools/source/skeletonmaker/skeletoncommon.cxx b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
index 966c147f1850..08df9ebf930f 100644
--- a/unodevtools/source/skeletonmaker/skeletoncommon.cxx
+++ b/unodevtools/source/skeletonmaker/skeletoncommon.cxx
@@ -90,7 +90,7 @@ bool getOutputStream(ProgramOptions const & options,
return bStandardout;
}
-bool containsAttribute(AttributeInfo& attributes, OUString const & attrname)
+static bool containsAttribute(AttributeInfo& attributes, OUString const & attrname)
{
for ( AttributeInfo::const_iterator i(attributes.begin());
i != attributes.end(); ++i ) {
@@ -102,7 +102,7 @@ bool containsAttribute(AttributeInfo& attributes, OUString const & attrname)
}
// collect attributes including inherited attributes
-void checkAttributes(rtl::Reference< TypeManager > const & manager,
+static void checkAttributes(rtl::Reference< TypeManager > const & manager,
OUString const & name,
AttributeInfo& attributes,
std::set< OUString >& propinterfaces)
@@ -281,7 +281,7 @@ void checkDefaultInterfaces(
}
}
-bool checkServiceProperties(rtl::Reference< TypeManager > const & manager,
+static bool checkServiceProperties(rtl::Reference< TypeManager > const & manager,
OUString const & name)
{
rtl::Reference< unoidl::Entity > ent;
@@ -362,7 +362,7 @@ OUString checkPropertyHelper(
return oldStyleWithProperties ? OUString("_") : OUString();
}
-bool checkXComponentSupport(
+static bool checkXComponentSupport(
rtl::Reference< TypeManager > const & manager, OUString const & name)
{
assert(manager.is());
@@ -447,7 +447,7 @@ checkAdditionalPropertyFlags(
// This function checks if the specified types for parameters and return
// types are allowed add-in types, for more info see the com.sun.star.sheet.AddIn
// service description
-bool checkAddinType(rtl::Reference< TypeManager > const & manager,
+static bool checkAddinType(rtl::Reference< TypeManager > const & manager,
OUString const & type, bool & bLastAny,
bool & bHasXPropertySet, bool bIsReturn)
{
@@ -494,7 +494,7 @@ bool checkAddinType(rtl::Reference< TypeManager > const & manager,
return false;
}
-void checkAddInTypes(
+static void checkAddInTypes(
rtl::Reference< TypeManager > const & manager, OUString const & name,
rtl::Reference< unoidl::InterfaceTypeEntity > const & entity)
{
@@ -543,7 +543,7 @@ void checkAddInTypes(
}
}
-void generateFunctionParameterMap(std::ostream& o,
+static void generateFunctionParameterMap(std::ostream& o,
ProgramOptions const & options,
rtl::Reference< TypeManager > const & manager,
OUString const & name,