diff options
Diffstat (limited to 'preproc.c')
-rw-r--r-- | preproc.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -2277,6 +2277,36 @@ static int parse_size(const char *str) { } /** + * find and process pragma directive in passed line + * Find out if a line contains a pragma directive, and deal + * with it if so. + * + * @param tline a pointer to the current tokeninzed line linked list + * @return DIRECTIVE_FOUND or NO_DIRECTIVE_FOUND + * + */ +static int do_pragma(Token * tline) +{ + enum pragma_token i; + + i = pr_token_hash(tline->text); + + switch (i) { + case PR_INVALID: + error(ERR_NONFATAL, "unknown pragma directive `%s'", + tline->text); + return NO_DIRECTIVE_FOUND; /* didn't get it */ + + default: + error(ERR_FATAL, + "pragma directive `%s' not yet implemented", + pr_directives[i]); + return DIRECTIVE_FOUND; + + } +} + +/** * find and process preprocessor directive in passed line * Find out if a line contains a preprocessor directive, and deal * with it if so. @@ -3903,6 +3933,18 @@ issue_error: free_tlist(origline); return DIRECTIVE_FOUND; + case PP_PRAGMA: + if (defining != NULL) return NO_DIRECTIVE_FOUND; + tline = tline->next; + skip_white_(tline); + if (tline == NULL) { + error(ERR_NONFATAL, "`%%pragma' expects at least one parameter"); + } else { + do_pragma(tline); + } + free_tlist(origline); + return DIRECTIVE_FOUND; + default: error(ERR_FATAL, "preprocessor directive `%s' not yet implemented", |