diff options
author | welinder@darter.rentec.com <welinder@darter.rentec.com> | 2004-09-13 11:48:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:11 -0700 |
commit | f336cf3c5e0b4eeeeb02cdd92828ecca75eea1d7 (patch) | |
tree | 51883d13d28f563a5f17a0df9d06032b0b0e1a29 /pre-process.c | |
parent | symbol.h, symbol.c: (diff) | |
download | sparse-f336cf3c5e0b4eeeeb02cdd92828ecca75eea1d7.tar.gz sparse-f336cf3c5e0b4eeeeb02cdd92828ecca75eea1d7.tar.bz2 sparse-f336cf3c5e0b4eeeeb02cdd92828ecca75eea1d7.zip |
Many files:
warn->warning
error->error_die
new error
lib.h:
warn->warning
error->error_die
new error
Add gcc format checking to warning/error/...
Diffstat (limited to 'pre-process.c')
-rw-r--r-- | pre-process.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/pre-process.c b/pre-process.c index 5f689ee..bb6dc6f 100644 --- a/pre-process.c +++ b/pre-process.c @@ -98,7 +98,7 @@ static void replace_with_defined(struct token *token) char *string[] = { "0", "1" }; int defined = 0; if (token_type(token) != TOKEN_IDENT) - warn(token->pos, "operator \"defined\" requires an identifier"); + warning(token->pos, "operator \"defined\" requires an identifier"); else if (lookup_symbol(token->ident, NS_MACRO)) defined = 1; token_type(token) = TOKEN_NUMBER; @@ -237,7 +237,7 @@ static int collect_arguments(struct token *start, struct token *arglist, struct return 1; Efew: - warn(what->pos, "macro \"%s\" requires %d arguments, but only %d given", + warning(what->pos, "macro \"%s\" requires %d arguments, but only %d given", show_token(what), wanted, count); goto out; Emany: @@ -247,11 +247,11 @@ Emany: } if (eof_token(next)) goto Eclosing; - warn(what->pos, "macro \"%s\" passed %d arguments, but takes just %d", + warning(what->pos, "macro \"%s\" passed %d arguments, but takes just %d", show_token(what), count, wanted); goto out; Eclosing: - warn(what->pos, "unterminated argument list invoking macro \"%s\"", + warning(what->pos, "unterminated argument list invoking macro \"%s\"", show_token(what)); out: what->next = next->next; @@ -400,7 +400,7 @@ static int merge(struct token *left, struct token *right) default: ; } - warn(left->pos, "'##' failed: concatenation is not a valid token"); + warning(left->pos, "'##' failed: concatenation is not a valid token"); return 0; } @@ -581,7 +581,7 @@ static const char *token_name_sequence(struct token *token, int endop, struct to } *ptr = 0; if (endop && !match_op(token, endop)) - warn(start->pos, "expected '>' at end of filename"); + warning(start->pos, "expected '>' at end of filename"); return buffer; } @@ -649,7 +649,7 @@ static void do_include(int local, struct stream *stream, struct token **list, st if (do_include_path(path, list, token, filename, flen)) return; out: - error(token->pos, "unable to open '%s'", filename); + error_die(token->pos, "unable to open '%s'", filename); } static int handle_include_path(struct stream *stream, struct token **list, struct token *token, const char **path) @@ -843,20 +843,20 @@ static struct token *parse_arguments(struct token *list) Emissing: - warn(arg->pos, "parameter name missing"); + warning(arg->pos, "parameter name missing"); return NULL; Ebadstuff: - warn(arg->pos, "\"%s\" may not appear in macro parameter list", + warning(arg->pos, "\"%s\" may not appear in macro parameter list", show_token(arg)); return NULL; Enotclosed: - warn(arg->pos, "missing ')' in macro parameter list"); + warning(arg->pos, "missing ')' in macro parameter list"); return NULL; Eva_args: - warn(arg->pos, "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro"); + warning(arg->pos, "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro"); return NULL; Eargs: - warn(arg->pos, "too many arguments in macro definition"); + warning(arg->pos, "too many arguments in macro definition"); return NULL; } @@ -950,14 +950,14 @@ static struct token *parse_expansion(struct token *expansion, struct token *argl return expansion; Equote: - warn(token->pos, "'#' is not followed by a macro parameter"); + warning(token->pos, "'#' is not followed by a macro parameter"); return NULL; Econcat: - warn(token->pos, "'##' cannot appear at the ends of macro expansion"); + warning(token->pos, "'##' cannot appear at the ends of macro expansion"); return NULL; Earg: - warn(token->pos, "too many instances of argument in body"); + warning(token->pos, "too many instances of argument in body"); return NULL; } @@ -969,7 +969,7 @@ static int handle_define(struct stream *stream, struct token **line, struct toke struct ident *name; if (token_type(left) != TOKEN_IDENT) { - warn(token->pos, "expected identifier to 'define'"); + warning(token->pos, "expected identifier to 'define'"); return 0; } if (false_nesting) @@ -997,7 +997,7 @@ static int handle_define(struct stream *stream, struct token **line, struct toke if (sym) { if (token_list_different(sym->expansion, expansion) || token_list_different(sym->arglist, arglist)) { - warn(left->pos, "preprocessor token %.*s redefined", + warning(left->pos, "preprocessor token %.*s redefined", name->len, name->name); info(sym->pos, "this was the original definition"); } @@ -1017,7 +1017,7 @@ static int handle_undef(struct stream *stream, struct token **line, struct token struct symbol **sym; if (token_type(left) != TOKEN_IDENT) { - warn(token->pos, "expected identifier to 'undef'"); + warning(token->pos, "expected identifier to 'undef'"); return 0; } if (false_nesting) @@ -1043,7 +1043,7 @@ static int preprocessor_if(struct token *token, int true) if (if_nesting == 0) unmatched_if = token; if (if_nesting >= MAX_NEST) - error(token->pos, "Maximum preprocessor conditional level exhausted"); + error_die(token->pos, "Maximum preprocessor conditional level exhausted"); elif_ignore[if_nesting] = (false_nesting || true) ? ELIF_IGNORE : 0; if (false_nesting || !true) { false_nesting++; @@ -1058,7 +1058,7 @@ static int token_defined(struct token *token) if (token_type(token) == TOKEN_IDENT) return lookup_symbol(token->ident, NS_MACRO) != NULL; - warn(token->pos, "expected identifier for #if[n]def"); + warning(token->pos, "expected identifier for #if[n]def"); return 0; } @@ -1125,7 +1125,7 @@ static int expression_value(struct token **where) case 3: state = 0; if (!match_op(p, ')')) - warn(p->pos, "missing ')' after \"defined\""); + warning(p->pos, "missing ')' after \"defined\""); *list = p->next; continue; } @@ -1134,7 +1134,7 @@ static int expression_value(struct token **where) p = constant_expression(*where, &expr); if (!eof_token(p)) - warn(p->pos, "garbage at end: %s", show_token_sequence(p)); + warning(p->pos, "garbage at end: %s", show_token_sequence(p)); value = get_expression_value(expr); return value != 0; } @@ -1160,12 +1160,12 @@ static int handle_elif(struct stream * stream, struct token **line, struct token MARK_STREAM_NONCONST(token->pos); if (stream->nesting > if_nesting) { - warn(token->pos, "unmatched #elif"); + warning(token->pos, "unmatched #elif"); return 1; } if (elif_ignore[if_nesting-1] & ELIF_SEEN_ELSE) - warn(token->pos, "#elif after #else"); + warning(token->pos, "#elif after #else"); if (false_nesting) { /* If this whole if-thing is if'ed out, an elif cannot help */ @@ -1189,12 +1189,12 @@ static int handle_else(struct stream *stream, struct token **line, struct token MARK_STREAM_NONCONST(token->pos); if (stream->nesting > if_nesting) { - warn(token->pos, "unmatched #else"); + warning(token->pos, "unmatched #else"); return 1; } if (elif_ignore[if_nesting-1] & ELIF_SEEN_ELSE) - warn(token->pos, "#else after #else"); + warning(token->pos, "#else after #else"); else elif_ignore[if_nesting-1] |= ELIF_SEEN_ELSE; @@ -1218,7 +1218,7 @@ static int handle_endif(struct stream *stream, struct token **line, struct token stream->constant = CONSTANT_FILE_MAYBE; if (stream->nesting > if_nesting) - warn(token->pos, "unmatched #endif"); + warning(token->pos, "unmatched #endif"); else if (false_nesting) false_nesting--; else @@ -1239,7 +1239,7 @@ static const char *show_token_sequence(struct token *token) int len = strlen(val); if (ptr + whitespace + len >= buffer + sizeof(buffer)) { - warn(token->pos, "too long token expansion"); + warning(token->pos, "too long token expansion"); break; } @@ -1260,7 +1260,7 @@ static int handle_warning(struct stream *stream, struct token **line, struct tok return 1; if (stream->constant == CONSTANT_FILE_MAYBE) MARK_STREAM_NONCONST(token->pos); - warn(token->pos, "%s", show_token_sequence(token->next)); + warning(token->pos, "%s", show_token_sequence(token->next)); return 1; } @@ -1270,7 +1270,7 @@ static int handle_error(struct stream *stream, struct token **line, struct token return 1; if (stream->constant == CONSTANT_FILE_MAYBE) MARK_STREAM_NONCONST(token->pos); - warn(token->pos, "%s", show_token_sequence(token->next)); + warning(token->pos, "%s", show_token_sequence(token->next)); return 1; } @@ -1307,7 +1307,7 @@ static void add_path_entry(struct token *token, const char *path) /* Need one free entry.. */ if (includepath[INCLUDEPATHS-2]) - error(token->pos, "too many include path entries"); + error_die(token->pos, "too many include path entries"); next = path; dst = sys_includepath; @@ -1335,7 +1335,7 @@ static int handle_add_include(struct stream *stream, struct token **line, struct if (eof_token(token)) return 1; if (token_type(token) != TOKEN_STRING) { - warn(token->pos, "expected path string"); + warning(token->pos, "expected path string"); return 1; } add_path_entry(token, token->string->data); @@ -1428,7 +1428,7 @@ static void handle_preprocessor_line(struct stream *stream, struct token **line, return; } - warn(token->pos, "unrecognized preprocessor line '%s'", show_token_sequence(token)); + warning(token->pos, "unrecognized preprocessor line '%s'", show_token_sequence(token)); } static void preprocessor_line(struct stream *stream, struct token **line) @@ -1464,7 +1464,7 @@ static void do_preprocess(struct token **list) switch (token_type(next)) { case TOKEN_STREAMEND: if (stream->nesting < if_nesting + 1) { - warn(unmatched_if->pos, "unterminated preprocessor conditional"); + warning(unmatched_if->pos, "unterminated preprocessor conditional"); // Pretend to see a series of #endifs MARK_STREAM_NONCONST(next->pos); do { |