widl: Support for toggling and checking status for warnings, support for warning 2368.
Signed-off-by: Sergei Bolotov <bolotov.s.s@yandex.ru> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
646dfe746d
commit
376daa91d8
|
@ -24,6 +24,8 @@
|
|||
|
||||
import "oaidl.idl"; /* needed by widl */
|
||||
|
||||
midl_pragma warning ( disable : 2368 )
|
||||
|
||||
[uuid(8b05fe77-4a6c-4133-b9cd-8f81747af784)]
|
||||
library Test
|
||||
{
|
||||
|
|
|
@ -45,6 +45,9 @@ void pop_import(void);
|
|||
|
||||
int is_type(const char *name);
|
||||
|
||||
int do_warning(char *toggle, warning_list_t *wnum);
|
||||
int is_warning_enabled(int warning);
|
||||
|
||||
extern char *temp_name;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -76,6 +76,8 @@ static int cbufalloc = 0;
|
|||
static int kw_token(const char *kw);
|
||||
static int attr_token(const char *kw);
|
||||
|
||||
static warning_list_t *disabled_warnings = NULL;
|
||||
|
||||
#define MAX_IMPORT_DEPTH 10
|
||||
struct {
|
||||
YY_BUFFER_STATE state;
|
||||
|
@ -556,3 +558,61 @@ void abort_import(void)
|
|||
for (ptr=0; ptr<import_stack_ptr; ptr++)
|
||||
unlink(import_stack[ptr].temp_name);
|
||||
}
|
||||
|
||||
static void warning_disable(int warning)
|
||||
{
|
||||
warning_t *warning_entry;
|
||||
LIST_FOR_EACH_ENTRY(warning_entry, disabled_warnings, warning_t, entry)
|
||||
if(warning_entry->num == warning)
|
||||
return;
|
||||
warning_entry = xmalloc( sizeof(*warning_entry) );
|
||||
warning_entry->num = warning;
|
||||
list_add_tail(disabled_warnings, &warning_entry->entry);
|
||||
}
|
||||
|
||||
static void warning_enable(int warning)
|
||||
{
|
||||
warning_t *warning_entry;
|
||||
LIST_FOR_EACH_ENTRY(warning_entry, disabled_warnings, warning_t, entry)
|
||||
if(warning_entry->num == warning)
|
||||
{
|
||||
list_remove(&warning_entry->entry);
|
||||
free(warning_entry);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int do_warning(char *toggle, warning_list_t *wnum)
|
||||
{
|
||||
warning_t *warning, *next;
|
||||
int ret = 1;
|
||||
if(!disabled_warnings)
|
||||
{
|
||||
disabled_warnings = xmalloc( sizeof(*disabled_warnings) );
|
||||
list_init( disabled_warnings );
|
||||
}
|
||||
|
||||
if(!strcmp(toggle, "disable"))
|
||||
LIST_FOR_EACH_ENTRY(warning, wnum, warning_t, entry)
|
||||
warning_disable(warning->num);
|
||||
else if(!strcmp(toggle, "enable"))
|
||||
LIST_FOR_EACH_ENTRY(warning, wnum, warning_t, entry)
|
||||
warning_enable(warning->num);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(warning, next, wnum, warning_t, entry)
|
||||
free(warning);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int is_warning_enabled(int warning)
|
||||
{
|
||||
warning_t *warning_entry;
|
||||
if(!disabled_warnings)
|
||||
return 1;
|
||||
LIST_FOR_EACH_ENTRY(warning_entry, disabled_warnings, warning_t, entry)
|
||||
if(warning_entry->num == warning)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -381,7 +381,14 @@ statement:
|
|||
| pragma_warning { $$ = NULL; }
|
||||
;
|
||||
|
||||
pragma_warning: tPRAGMA_WARNING '(' aIDENTIFIER ':' warnings ')' { $$ = NULL; }
|
||||
pragma_warning: tPRAGMA_WARNING '(' aIDENTIFIER ':' warnings ')'
|
||||
{
|
||||
int result;
|
||||
$$ = NULL;
|
||||
result = do_warning($3, $5);
|
||||
if(!result)
|
||||
error_loc("expected \"disable\" or \"enable\"\n");
|
||||
}
|
||||
;
|
||||
|
||||
warnings:
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "header.h"
|
||||
#include "hash.h"
|
||||
#include "typetree.h"
|
||||
#include "parser.h"
|
||||
|
||||
enum MSFT_segment_index {
|
||||
MSFT_SEG_TYPEINFO = 0, /* type information */
|
||||
|
@ -504,7 +505,7 @@ static int ctl2_alloc_guid(
|
|||
offset = ctl2_find_guid(typelib, hash_key, &guid->guid);
|
||||
if (offset != -1)
|
||||
{
|
||||
if (pedantic)
|
||||
if (is_warning_enabled(2368))
|
||||
warning("duplicate uuid {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
|
||||
guid->guid.Data1, guid->guid.Data2, guid->guid.Data3,
|
||||
guid->guid.Data4[0], guid->guid.Data4[1], guid->guid.Data4[2], guid->guid.Data4[3],
|
||||
|
|
Loading…
Reference in New Issue