This should essentially be "reset to default behavior" for specified warnings, which is what "enabling" does in WIDL. Increases IDL file format compatibility.
Signed-off-by: Andrew Boyarshin andrew.boyarshin@gmail.com --- tools/widl/parser.h | 2 +- tools/widl/parser.l | 4 ++-- tools/widl/parser.y | 8 ++++++++ 3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/widl/parser.h b/tools/widl/parser.h index a67b160d48aa..bc0c50792e19 100644 --- a/tools/widl/parser.h +++ b/tools/widl/parser.h @@ -39,7 +39,7 @@ void pop_import(void);
int is_type(const char *name);
-int do_warning(char *toggle, warning_list_t *wnum); +int do_warning(const char *toggle, warning_list_t *wnum); int is_warning_enabled(int warning);
extern char *temp_name; diff --git a/tools/widl/parser.l b/tools/widl/parser.l index 946dba84cd65..3e34bc411739 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -645,7 +645,7 @@ static void warning_enable(int warning) } }
-int do_warning(char *toggle, warning_list_t *wnum) +int do_warning(const char *toggle, warning_list_t *wnum) { warning_t *warning, *next; int ret = 1; @@ -658,7 +658,7 @@ int do_warning(char *toggle, warning_list_t *wnum) if(!strcmp(toggle, "disable")) LIST_FOR_EACH_ENTRY(warning, wnum, warning_t, entry) warning_disable(warning->num); - else if(!strcmp(toggle, "enable")) + else if(!strcmp(toggle, "enable") || !strcmp(toggle, "default")) LIST_FOR_EACH_ENTRY(warning, wnum, warning_t, entry) warning_enable(warning->num); else diff --git a/tools/widl/parser.y b/tools/widl/parser.y index a6128074f2d5..b419f540108c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -426,6 +426,14 @@ pragma_warning: tPRAGMA_WARNING '(' aIDENTIFIER ':' warnings ')' if(!result) error_loc("expected "disable" or "enable"\n"); } + | tPRAGMA_WARNING '(' tDEFAULT ':' warnings ')' + { + int result; + $$ = NULL; + result = do_warning("default", $5); + if(!result) + error_loc("expected "default"\n"); + } ;
warnings: