diff options
author | Stef Walter <stefw@gnome.org> | 2013-04-19 16:18:40 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-10-21 20:42:10 +0200 |
commit | 917da2d1aeffdc884a5fd5cf5b38a60ef088d0fb (patch) | |
tree | 115a99b4da986468aca556aec5af292626807948 /giscanner/scannerlexer.l | |
parent | ebb80508d6959a0c94351e841c2cab6220602e62 (diff) | |
download | gobject-introspection-917da2d1aeffdc884a5fd5cf5b38a60ef088d0fb.tar.gz |
giscanner: Respect __GI_SCANNER__ when scanning for macros
When scanning for macros respect ifdefs of __GI_SCANNER__
in the various header files. Only #ifdef and #ifndef are supported.
If __GI_SCANNER__ appears in plain #if statements, a warning is
printed.
https://bugzilla.gnome.org/show_bug.cgi?id=698367
Diffstat (limited to 'giscanner/scannerlexer.l')
-rw-r--r-- | giscanner/scannerlexer.l | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l index f30191db..7734938a 100644 --- a/giscanner/scannerlexer.l +++ b/giscanner/scannerlexer.l @@ -80,6 +80,14 @@ stringtext ([^\\\"])|(\\.) "#define "[a-zA-Z_][a-zA-Z_0-9]*"(" { yyless (yyleng - 1); return FUNCTION_MACRO; } "#define "[a-zA-Z_][a-zA-Z_0-9]* { return OBJECT_MACRO; } +"#ifdef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { return IFDEF_GI_SCANNER; } +"#ifndef"[\t ]+"__GI_SCANNER__"[\t ]?.*"\n" { return IFNDEF_GI_SCANNER; } +"#ifndef ".*"\n" { return IFNDEF_COND; } +"#ifdef ".*"\n" { return IFDEF_COND; } +"#if ".*"\n" { return IF_COND; } +"#elif ".*"\n" { return ELIF_COND; } +"#else".*"\n" { return ELSE_COND; } +"#endif".*"\n" { return ENDIF_COND; } "#pragma ".*"\n" { /* Ignore pragma. */ } "# "[0-9]+" ".*"\n" { process_linemarks(scanner); } @@ -269,7 +277,7 @@ parse_comment (GISourceScanner *scanner) comment->line = comment_lineno; comment->filename = g_file_get_parse_name (scanner->current_file); - scanner->comments = g_slist_prepend (scanner->comments, comment); + gi_source_scanner_take_comment (scanner, comment); } else { /* * Ignore all other comment blocks |