summaryrefslogtreecommitdiff
path: root/idlc
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 /idlc
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 'idlc')
-rw-r--r--idlc/source/astscope.cxx2
-rw-r--r--idlc/source/idlccompile.cxx2
-rw-r--r--idlc/source/parser.y12
3 files changed, 8 insertions, 8 deletions
diff --git a/idlc/source/astscope.cxx b/idlc/source/astscope.cxx
index 5fd9d5339d68..5ab066c2ec5f 100644
--- a/idlc/source/astscope.cxx
+++ b/idlc/source/astscope.cxx
@@ -24,7 +24,7 @@
#include <osl/diagnose.h>
-bool isGlobal(const OString& scopedName)
+static bool isGlobal(const OString& scopedName)
{
return scopedName.isEmpty() || scopedName.startsWith(":");
}
diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx
index 3492e899e733..5a16c9fadc49 100644
--- a/idlc/source/idlccompile.cxx
+++ b/idlc/source/idlccompile.cxx
@@ -114,7 +114,7 @@ OString convertToFileUrl(const OString& fileName)
return fileName;
}
-OString makeTempName(const OString& prefix)
+static OString makeTempName(const OString& prefix)
{
OUString uTmpPath;
OString tmpPath;
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 71b88d05c816..9cd8f4465894 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -64,9 +64,9 @@ using ::rtl::OStringToOUString;
using ::rtl::OStringBuffer;
extern int yylex(void);
-void yyerror(char const *);
+static void yyerror(char const *);
-void checkIdentifier(::rtl::OString const * id)
+static void checkIdentifier(::rtl::OString const * id)
{
static short check = 0;
if (check == 0) {
@@ -93,7 +93,7 @@ void checkIdentifier(::rtl::OString const * id)
}
}
-void reportDoubleMemberDeclarations(
+static void reportDoubleMemberDeclarations(
AstInterface::DoubleMemberDeclarations const & doubleMembers)
{
for (auto const& doubleMember : doubleMembers)
@@ -102,7 +102,7 @@ void reportDoubleMemberDeclarations(
}
}
-void addInheritedInterface(
+static void addInheritedInterface(
AstInterface * ifc, rtl::OString const & name, bool optional,
rtl::OUString const & documentation)
{
@@ -140,7 +140,7 @@ void addInheritedInterface(
}
}
-AstDeclaration const * createNamedType(
+static AstDeclaration const * createNamedType(
rtl::OString const * scopedName, DeclList const * typeArgs)
{
AstDeclaration * decl = idlc()->scopes()->topNonNull()->lookupByName(
@@ -179,7 +179,7 @@ AstDeclaration const * createNamedType(
return decl;
}
-bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
+static bool includes(AstDeclaration const * type1, AstDeclaration const * type2) {
OSL_ASSERT(type2 != nullptr);
if (type1 != nullptr) {
if (type1->getNodeType() == NT_instantiated_struct) {