summaryrefslogtreecommitdiff
path: root/hwpfilter
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 /hwpfilter
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 'hwpfilter')
-rw-r--r--hwpfilter/source/grammar.cxx6
-rw-r--r--hwpfilter/source/hwpeq.cxx4
-rw-r--r--hwpfilter/source/lexer.cxx24
-rw-r--r--hwpfilter/source/mzstring.cxx2
4 files changed, 18 insertions, 18 deletions
diff --git a/hwpfilter/source/grammar.cxx b/hwpfilter/source/grammar.cxx
index d4dd3630b341..8ecb9696fa83 100644
--- a/hwpfilter/source/grammar.cxx
+++ b/hwpfilter/source/grammar.cxx
@@ -42,7 +42,7 @@ extern "C" {
std::vector<Node*> nodelist;
-void yyerror(const char *);
+static void yyerror(const char *);
static Node *top=nullptr;
@@ -51,7 +51,7 @@ int Node::count = 0;
#ifdef PARSE_DEBUG
#define debug printf
#else
-int debug(const char *format, ...);
+static int debug(const char *format, ...);
#endif
#include <stdio.h>
@@ -441,7 +441,7 @@ int yydebug; /* nonzero means print parse trace */
#ifdef YYPARSE_PARAM
int yyparse (void *);
#else
-int yyparse();
+static int yyparse();
#endif
#endif
diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx
index 5613a1bd562a..ca42907abd3c 100644
--- a/hwpfilter/source/hwpeq.cxx
+++ b/hwpfilter/source/hwpeq.cxx
@@ -410,7 +410,7 @@ static const hwpeq *lookup_eqn(char const *str)
}
/* If only the first character is uppercase or all characters are uppercase, change to lowercase */
-void make_keyword( char *keyword, const char *token)
+static void make_keyword( char *keyword, const char *token)
{
char* ptr;
bool result = true;
@@ -467,7 +467,7 @@ struct eq_stack {
static eq_stack *stk = nullptr;
-void push_token(MzString const &white, MzString const &token, istream *strm)
+static void push_token(MzString const &white, MzString const &token, istream *strm)
{
// one time stack
assert(stk->token.length() == 0);
diff --git a/hwpfilter/source/lexer.cxx b/hwpfilter/source/lexer.cxx
index 0439c9933b54..6595a5ae4cb8 100644
--- a/hwpfilter/source/lexer.cxx
+++ b/hwpfilter/source/lexer.cxx
@@ -188,18 +188,18 @@ static int yy_start = 0; /* start state number */
*/
static int yy_did_buffer_switch_on_eof;
-void yyrestart YY_PROTO(( FILE *input_file ));
+static void yyrestart YY_PROTO(( FILE *input_file ));
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+static void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+static void yy_load_buffer_state YY_PROTO(( void ));
+static YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+static void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+static void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+static void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+static YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+static YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+static YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
@@ -942,13 +942,13 @@ static char *yytext;
extern "C" {
#include "grammar.h"
-int yywrap();
+static int yywrap();
}
#ifdef TOKEN_DEBUG
#define token_debug printf
#else
-int token_debug(const char *format, ...);
+static int token_debug(const char *format, ...);
#endif
/* Macros after this point can all be overridden by user definitions in
diff --git a/hwpfilter/source/mzstring.cxx b/hwpfilter/source/mzstring.cxx
index dae04be2169b..4327a3315f4d 100644
--- a/hwpfilter/source/mzstring.cxx
+++ b/hwpfilter/source/mzstring.cxx
@@ -39,7 +39,7 @@
const int AllocSize = 8;
-inline int get_alloc_size(int len)
+static inline int get_alloc_size(int len)
{
return (len + AllocSize - 1) / AllocSize * AllocSize;
}