[WIDL] Sync with Wine Staging 1.9.11. CORE-11368

svn path=/trunk/; revision=71775
This commit is contained in:
Amine Khaldi 2016-07-03 11:16:23 +00:00
parent 893c145538
commit 234f15fb5c
17 changed files with 4804 additions and 2733 deletions

View file

@ -16,7 +16,7 @@ wine-patches@winehq.com and ros-dev@reactos.org
The following build tools are shared with Wine.
reactos/tools/unicode # Synced to WineStaging-1.9.11
reactos/tools/widl # Synced to WineStaging-1.7.55
reactos/tools/widl # Synced to WineStaging-1.9.11
reactos/tools/wpp # Synced to WineStaging-1.9.4
The following libraries are shared with Wine.

View file

@ -26,6 +26,7 @@ list(APPEND SOURCE
utils.c
widl.c
write_msft.c
write_sltg.c
parser.yy.c
parser.tab.c
port/mkstemps.c)

View file

@ -35,6 +35,7 @@
#include "header.h"
#include "expr.h"
#include "typetree.h"
#include "typelib.h"
static int indentation = 0;
static int is_object_interface = 0;
@ -1009,6 +1010,16 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i
/* Output default value only if all following arguments also have default value. */
LIST_FOR_EACH_ENTRY_REV( tail_arg, args, const var_t, entry ) {
if(tail_arg == arg) {
expr_t bstr;
/* Fixup the expression type for a BSTR like midl does. */
if (get_type_vt(arg->type) == VT_BSTR && expr->type == EXPR_STRLIT)
{
bstr = *expr;
bstr.type = EXPR_WSTRLIT;
expr = &bstr;
}
fprintf(h, " = ");
write_expr( h, expr, 0, 1, NULL, NULL, "" );
break;

View file

@ -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

View file

@ -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;
@ -164,6 +166,7 @@ UUID *parse_uuid(const char *u)
yy_pop_state();
}
<PP_PRAGMA>[^\n]* parser_lval.str = xstrdup(yytext); yy_pop_state(); return aPRAGMA;
<INITIAL>^{ws}*midl_pragma{ws}+warning return tPRAGMA_WARNING;
<INITIAL,ATTR>\" yy_push_state(QUOTE); cbufidx = 0;
<QUOTE>\" {
yy_pop_state();
@ -555,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;
}

File diff suppressed because it is too large Load diff

View file

@ -1,4 +1,4 @@
/* A Bison parser, made by GNU Bison 3.0.2. */
/* A Bison parser, made by GNU Bison 3.0. */
/* Bison interface for Yacc-like parsers in C
@ -30,8 +30,8 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_PARSER_PARSER_TAB_H_INCLUDED
# define YY_PARSER_PARSER_TAB_H_INCLUDED
#ifndef YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
# define YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
@ -169,65 +169,66 @@ extern int parser_debug;
tPARTIALIGNORE = 379,
tPASCAL = 380,
tPOINTERDEFAULT = 381,
tPROGID = 382,
tPROPERTIES = 383,
tPROPGET = 384,
tPROPPUT = 385,
tPROPPUTREF = 386,
tPROXY = 387,
tPTR = 388,
tPUBLIC = 389,
tRANGE = 390,
tREADONLY = 391,
tREF = 392,
tREGISTER = 393,
tREPRESENTAS = 394,
tREQUESTEDIT = 395,
tRESTRICTED = 396,
tRETVAL = 397,
tSAFEARRAY = 398,
tSHORT = 399,
tSIGNED = 400,
tSIZEIS = 401,
tSIZEOF = 402,
tSMALL = 403,
tSOURCE = 404,
tSTATIC = 405,
tSTDCALL = 406,
tSTRICTCONTEXTHANDLE = 407,
tSTRING = 408,
tSTRUCT = 409,
tSWITCH = 410,
tSWITCHIS = 411,
tSWITCHTYPE = 412,
tTHREADING = 413,
tTRANSMITAS = 414,
tTRUE = 415,
tTYPEDEF = 416,
tUIDEFAULT = 417,
tUNION = 418,
tUNIQUE = 419,
tUNSIGNED = 420,
tUSESGETLASTERROR = 421,
tUSERMARSHAL = 422,
tUUID = 423,
tV1ENUM = 424,
tVARARG = 425,
tVERSION = 426,
tVIPROGID = 427,
tVOID = 428,
tWCHAR = 429,
tWIREMARSHAL = 430,
tAPARTMENT = 431,
tNEUTRAL = 432,
tSINGLE = 433,
tFREE = 434,
tBOTH = 435,
CAST = 436,
PPTR = 437,
POS = 438,
NEG = 439,
ADDRESSOF = 440
tPRAGMA_WARNING = 382,
tPROGID = 383,
tPROPERTIES = 384,
tPROPGET = 385,
tPROPPUT = 386,
tPROPPUTREF = 387,
tPROXY = 388,
tPTR = 389,
tPUBLIC = 390,
tRANGE = 391,
tREADONLY = 392,
tREF = 393,
tREGISTER = 394,
tREPRESENTAS = 395,
tREQUESTEDIT = 396,
tRESTRICTED = 397,
tRETVAL = 398,
tSAFEARRAY = 399,
tSHORT = 400,
tSIGNED = 401,
tSIZEIS = 402,
tSIZEOF = 403,
tSMALL = 404,
tSOURCE = 405,
tSTATIC = 406,
tSTDCALL = 407,
tSTRICTCONTEXTHANDLE = 408,
tSTRING = 409,
tSTRUCT = 410,
tSWITCH = 411,
tSWITCHIS = 412,
tSWITCHTYPE = 413,
tTHREADING = 414,
tTRANSMITAS = 415,
tTRUE = 416,
tTYPEDEF = 417,
tUIDEFAULT = 418,
tUNION = 419,
tUNIQUE = 420,
tUNSIGNED = 421,
tUSESGETLASTERROR = 422,
tUSERMARSHAL = 423,
tUUID = 424,
tV1ENUM = 425,
tVARARG = 426,
tVERSION = 427,
tVIPROGID = 428,
tVOID = 429,
tWCHAR = 430,
tWIREMARSHAL = 431,
tAPARTMENT = 432,
tNEUTRAL = 433,
tSINGLE = 434,
tFREE = 435,
tBOTH = 436,
CAST = 437,
PPTR = 438,
POS = 439,
NEG = 440,
ADDRESSOF = 441
};
#endif
@ -236,7 +237,7 @@ extern int parser_debug;
typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{
#line 137 "parser.y" /* yacc.c:1909 */
#line 138 "parser.y" /* yacc.c:1909 */
attr_t *attr;
attr_list_t *attr_list;
@ -251,6 +252,8 @@ union YYSTYPE
declarator_list_t *declarator_list;
statement_t *statement;
statement_list_t *stmt_list;
warning_t *warning;
warning_list_t *warning_list;
ifref_t *ifref;
ifref_list_t *ifref_list;
char *str;
@ -263,7 +266,7 @@ union YYSTYPE
struct _decl_spec_t *declspec;
enum storage_class stgclass;
#line 267 "parser.tab.h" /* yacc.c:1909 */
#line 270 "parser.tab.h" /* yacc.c:1909 */
};
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
@ -274,4 +277,4 @@ extern YYSTYPE parser_lval;
int parser_parse (void);
#endif /* !YY_PARSER_PARSER_TAB_H_INCLUDED */
#endif /* !YY_PARSER_E_REACTOS_SYNC_GCC_HOST_TOOLS_SDK_TOOLS_WIDL_PARSER_TAB_H_INCLUDED */

View file

@ -83,6 +83,7 @@ static declarator_t *make_declarator(var_t *var);
static type_t *make_safearray(type_t *type);
static typelib_t *make_library(const char *name, const attr_list_t *attrs);
static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type);
static warning_list_t *append_warning(warning_list_t *, int);
static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs);
static type_t *find_type_or_error(const char *name, int t);
@ -148,6 +149,8 @@ static struct namespace *current_namespace = &global_namespace;
declarator_list_t *declarator_list;
statement_t *statement;
statement_list_t *stmt_list;
warning_t *warning;
warning_list_t *warning_list;
ifref_t *ifref;
ifref_list_t *ifref_list;
char *str;
@ -224,6 +227,7 @@ static struct namespace *current_namespace = &global_namespace;
%token tOUT
%token tPARTIALIGNORE tPASCAL
%token tPOINTERDEFAULT
%token tPRAGMA_WARNING
%token tPROGID tPROPERTIES
%token tPROPGET tPROPPUT tPROPPUTREF
%token tPROXY tPTR
@ -291,8 +295,9 @@ static struct namespace *current_namespace = &global_namespace;
%type <uuid> uuid_string
%type <import> import_start
%type <typelib> library_start librarydef
%type <statement> statement typedef
%type <statement> statement typedef pragma_warning
%type <stmt_list> gbl_statements imp_statements int_statements
%type <warning_list> warnings
%left ','
%right '?' ':'
@ -373,6 +378,22 @@ statement:
| import { $$ = make_statement_import($1); }
| typedef ';' { $$ = $1; }
| aPRAGMA { $$ = make_statement_pragma($1); }
| pragma_warning { $$ = 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:
aNUM { $$ = append_warning(NULL, $1); }
| warnings aNUM { $$ = append_warning($1, $2); }
;
typedecl:
@ -1413,6 +1434,21 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
return ptrchain;
}
static warning_list_t *append_warning(warning_list_t *list, int num)
{
warning_t *entry;
if(!list)
{
list = xmalloc( sizeof(*list) );
list_init( list );
}
entry = xmalloc( sizeof(*entry) );
entry->num = num;
list_add_tail( list, &entry->entry );
return list;
}
static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
int top)
{

File diff suppressed because it is too large Load diff

View file

@ -247,7 +247,10 @@ void end_typelib(void)
{
if (!typelib) return;
create_msft_typelib(typelib);
if (do_old_typelib)
create_sltg_typelib(typelib);
else
create_msft_typelib(typelib);
}
static void tlb_read(int fd, void *buf, int count)

View file

@ -85,4 +85,5 @@ enum VARENUM {
extern unsigned short get_type_vt(type_t *t);
extern int create_msft_typelib(typelib_t *typelib);
extern int create_sltg_typelib(typelib_t *typelib);
#endif

View file

@ -215,7 +215,7 @@ typedef struct {
/* after this may follow an array with default value pointers if the
* appropriate bit in the FKCCIC field has been set:
* INT oDefautlValue[nrargs];
* INT oDefaultValue[nrargs];
*/
/* Parameter info one per argument*/

View file

@ -65,6 +65,7 @@ static const char usage[] =
" -m32, -m64 Set the kind of typelib to build (Win32 or Win64)\n"
" -N Do not preprocess input\n"
" --oldnames Use old naming conventions\n"
" --oldtlb Use old typelib (SLTG) format\n"
" -o, --output=NAME Set the output file name\n"
" -Otype Type of stubs to generate (-Os, -Oi, -Oif)\n"
" -p Generate proxy\n"
@ -103,6 +104,7 @@ int do_everything = 1;
static int preprocess_only = 0;
int do_header = 0;
int do_typelib = 0;
int do_old_typelib = 0;
int do_proxies = 0;
int do_client = 0;
int do_server = 0;
@ -163,7 +165,8 @@ enum {
WIN64_OPTION,
WIN32_ALIGN_OPTION,
WIN64_ALIGN_OPTION,
APP_CONFIG_OPTION
APP_CONFIG_OPTION,
OLD_TYPELIB_OPTION
};
static const char short_options[] =
@ -185,6 +188,7 @@ static const struct option long_options[] = {
{ "win32-align", 1, NULL, WIN32_ALIGN_OPTION },
{ "win64-align", 1, NULL, WIN64_ALIGN_OPTION },
{ "app_config", 0, NULL, APP_CONFIG_OPTION },
{ "oldtlb", 0, NULL, OLD_TYPELIB_OPTION },
{ NULL, 0, NULL, 0 }
};
@ -306,6 +310,7 @@ static void set_everything(int x)
{
do_header = x;
do_typelib = x;
do_old_typelib = x;
do_proxies = x;
do_client = x;
do_server = x;
@ -691,6 +696,9 @@ int main(int argc,char *argv[])
do_everything = 0;
do_typelib = 1;
break;
case OLD_TYPELIB_OPTION:
do_old_typelib = 1;
break;
case 'T':
typelib_name = xstrdup(optarg);
break;

View file

@ -38,6 +38,7 @@ extern int pedantic;
extern int do_everything;
extern int do_header;
extern int do_typelib;
extern int do_old_typelib;
extern int do_proxies;
extern int do_client;
extern int do_server;

View file

@ -21,15 +21,6 @@
#ifndef __WIDL_WIDLTYPES_H
#define __WIDL_WIDLTYPES_H
#define S_OK 0
#define S_FALSE 1
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#define TYPE_E_IOERROR ((HRESULT)0x80028CA2L)
#ifndef max
#define max(a, b) ((a) > (b) ? a : b)
#endif
#include <stdarg.h>
#include <assert.h>
#include "guiddef.h"
@ -60,6 +51,7 @@ typedef struct _user_type_t context_handle_t;
typedef struct _user_type_t generic_handle_t;
typedef struct _type_list_t type_list_t;
typedef struct _statement_t statement_t;
typedef struct _warning_t warning_t;
typedef struct list attr_list_t;
typedef struct list str_list_t;
@ -72,6 +64,7 @@ typedef struct list user_type_list_t;
typedef struct list context_handle_list_t;
typedef struct list generic_handle_list_t;
typedef struct list statement_list_t;
typedef struct list warning_list_t;
enum attr_type
{
@ -547,6 +540,11 @@ struct _statement_t {
} u;
};
struct _warning_t {
int num;
struct list entry;
};
typedef enum {
SYS_WIN16,
SYS_WIN32,

View file

@ -50,6 +50,12 @@
#include "hash.h"
#include "typetree.h"
#ifdef __REACTOS__
#define S_OK 0
#define S_FALSE 1
#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
#endif
enum MSFT_segment_index {
MSFT_SEG_TYPEINFO = 0, /* type information */
MSFT_SEG_IMPORTINFO, /* import information */
@ -502,7 +508,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],

File diff suppressed because it is too large Load diff