diff options
author | Keith Kanios <keith@kanios.net> | 2011-04-09 22:18:47 -0500 |
---|---|---|
committer | Keith Kanios <keith@kanios.net> | 2011-04-09 22:18:47 -0500 |
commit | 47308e9797b1e9ff92ebbfc648dd04c123e273a7 (patch) | |
tree | 9faf53a3b8e723bff29c07848aebe05946f1fd4d /preproc.c | |
parent | 918317c4ce857458b219b132094eacd8e9b96931 (diff) | |
download | nasm-pragma.tar.gz |
initial branch of %pragma supportpragma
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", |