Silently skip #pragma directives when scanning sources.
authorPavel Holejsovsky <pavel.holejsovsky@gmail.com>
Thu, 30 Sep 2010 09:38:55 +0000 (11:38 +0200)
committerJohan Dahlin <johan@gnome.org>
Sun, 3 Oct 2010 13:03:59 +0000 (10:03 -0300)
This is useful e.g. on cygwin, where system headers use #pragma directives,
causing annoying false-alarm errors during every g-ir-scanner run.

https://bugzilla.gnome.org/show_bug.cgi?id=630994

giscanner/scannerlexer.l

index 5b68ca050882bd93663265408515f22de9dae8e9..e06bc85d0d0241cfd28090cbd92af2c7a4b0b8f9 100644 (file)
@@ -78,6 +78,7 @@ 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; }
+"#pragma ".*"\n"                       { /* Ignore pragma. */ }
 
 "# "[0-9]+" ".*"\n"                    { process_linemarks(scanner); }
 "#"                                    { }