aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/parse.c
diff options
authorJohn Levon <john.levon@joyent.com>2019-11-12 16:13:58 +0000
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2019-11-12 21:51:31 +0100
commitfd3528aa0409874386610ce63bb647fff8312fd9 (patch)
tree8f704874f4cbc634a9359f3fbf047f4eb907c9ee /parse.c
parentcb75739a5e07b0f435b9e2685033e1ba9ebc31cf (diff)
downloadsparse-dev-fd3528aa0409874386610ce63bb647fff8312fd9.tar.gz
Add -Wexternal-function-has-definition
Some older codebases hit this warning all the time, so it's useful to be able to disable it. Signed-off-by: John Levon <john.levon@joyent.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse.c b/parse.c
index 4b0a1566..fa92fae6 100644
--- a/parse.c
+++ b/parse.c
@@ -2769,8 +2769,8 @@ static struct token *parse_function_body(struct token *token, struct symbol *dec
function_computed_target_list = NULL;
function_computed_goto_list = NULL;
- if (decl->ctype.modifiers & MOD_EXTERN) {
- if (!(decl->ctype.modifiers & MOD_INLINE))
+ if ((decl->ctype.modifiers & (MOD_EXTERN|MOD_INLINE)) == MOD_EXTERN) {
+ if (Wexternal_function_has_definition)
warning(decl->pos, "function '%s' with external linkage has definition", show_ident(decl->ident));
}
if (!(decl->ctype.modifiers & MOD_STATIC))