* Sync with Wine 1.7.27.
CORE-8540

svn path=/trunk/; revision=64205
This commit is contained in:
Amine Khaldi 2014-09-20 18:53:11 +00:00
parent abb354e4da
commit 1b9bf5a3bd
9 changed files with 819 additions and 1078 deletions

View file

@ -23,7 +23,7 @@ The following build tools are shared with Wine.
reactos/tools/unicode # Synced to Wine-1.7.27 reactos/tools/unicode # Synced to Wine-1.7.27
reactos/tools/widl # Synced to Wine-1.7.17 reactos/tools/widl # Synced to Wine-1.7.17
reactos/tools/wpp # Synced to Wine-1.7.17 reactos/tools/wpp # Synced to Wine-1.7.27
The following libraries are shared with Wine. The following libraries are shared with Wine.

View file

@ -213,7 +213,7 @@ typedef struct bufferstackentry {
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
int line_number; /* Line that we were handling */ int line_number; /* Line that we were handling */
int char_number; /* The current position on that line */ int char_number; /* The current position on that line */
const char *filename; /* Filename that we were handling */ char *filename; /* Filename that we were handling */
int if_depth; /* How many #if:s deep to check matching #endif:s */ int if_depth; /* How many #if:s deep to check matching #endif:s */
int ncontinuations; /* Remember the continuation state */ int ncontinuations; /* Remember the continuation state */
int should_pop; /* Set if we must pop the start-state on EOF */ int should_pop; /* Set if we must pop the start-state on EOF */
@ -1340,6 +1340,8 @@ static bufferstackentry_t *pop_buffer(void)
bufferstack[bufferstackidx].define->expanding = 0; bufferstack[bufferstackidx].define->expanding = 0;
else else
{ {
includelogicentry_t *iep = NULL;
if(!bufferstack[bufferstackidx].should_pop) if(!bufferstack[bufferstackidx].should_pop)
{ {
wpp_callbacks->close(pp_status.file); wpp_callbacks->close(pp_status.file);
@ -1351,32 +1353,37 @@ static bufferstackentry_t *pop_buffer(void)
pp_entry_t *ppp = pplookup(pp_incl_state.ppp); pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
if(ppp) if(ppp)
{ {
includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t)); iep = pp_xmalloc(sizeof(includelogicentry_t));
if(!iep) if (iep)
return NULL; {
iep->ppp = ppp;
iep->ppp = ppp; ppp->iep = iep;
ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename;
iep->filename = bufferstack[bufferstackidx].include_filename; iep->prev = NULL;
iep->prev = NULL; iep->next = pp_includelogiclist;
iep->next = pp_includelogiclist; if(iep->next)
if(iep->next) iep->next->prev = iep;
iep->next->prev = iep; pp_includelogiclist = iep;
pp_includelogiclist = iep; if(pp_status.debug)
if(pp_status.debug) fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n",
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
}
} }
else
free(bufferstack[bufferstackidx].include_filename);
} }
free(pp_incl_state.ppp); free(pp_incl_state.ppp);
pp_incl_state = bufferstack[bufferstackidx].incl; pp_incl_state = bufferstack[bufferstackidx].incl;
} }
if (bufferstack[bufferstackidx].include_filename)
{
free(pp_status.input);
pp_status.input = bufferstack[bufferstackidx].filename;
}
pp_status.line_number = bufferstack[bufferstackidx].line_number; pp_status.line_number = bufferstack[bufferstackidx].line_number;
pp_status.char_number = bufferstack[bufferstackidx].char_number; pp_status.char_number = bufferstack[bufferstackidx].char_number;
pp_status.input = bufferstack[bufferstackidx].filename;
ncontinuations = bufferstack[bufferstackidx].ncontinuations; ncontinuations = bufferstack[bufferstackidx].ncontinuations;
if (!iep)
free(bufferstack[bufferstackidx].include_filename);
} }
if(ppy_debug) if(ppy_debug)
@ -1586,6 +1593,7 @@ void pp_do_include(char *fname, int type)
* If the define was deleted, then this entry would have * If the define was deleted, then this entry would have
* been deleted too. * been deleted too.
*/ */
free(fname);
return; return;
} }
} }
@ -1595,6 +1603,7 @@ void pp_do_include(char *fname, int type)
if(n <= 2) if(n <= 2)
{ {
ppy_error("Empty include filename"); ppy_error("Empty include filename");
free(fname);
return; return;
} }
@ -1604,6 +1613,7 @@ void pp_do_include(char *fname, int type)
if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL)
{ {
ppy_error("Unable to open include file %s", fname+1); ppy_error("Unable to open include file %s", fname+1);
free(fname);
return; return;
} }

View file

@ -1251,7 +1251,7 @@ typedef struct bufferstackentry {
pp_entry_t *define; /* Points to expanding define or NULL if handling includes */ pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
int line_number; /* Line that we were handling */ int line_number; /* Line that we were handling */
int char_number; /* The current position on that line */ int char_number; /* The current position on that line */
const char *filename; /* Filename that we were handling */ char *filename; /* Filename that we were handling */
int if_depth; /* How many #if:s deep to check matching #endif:s */ int if_depth; /* How many #if:s deep to check matching #endif:s */
int ncontinuations; /* Remember the continuation state */ int ncontinuations; /* Remember the continuation state */
int should_pop; /* Set if we must pop the start-state on EOF */ int should_pop; /* Set if we must pop the start-state on EOF */
@ -4292,6 +4292,8 @@ static bufferstackentry_t *pop_buffer(void)
bufferstack[bufferstackidx].define->expanding = 0; bufferstack[bufferstackidx].define->expanding = 0;
else else
{ {
includelogicentry_t *iep = NULL;
if(!bufferstack[bufferstackidx].should_pop) if(!bufferstack[bufferstackidx].should_pop)
{ {
wpp_callbacks->close(pp_status.file); wpp_callbacks->close(pp_status.file);
@ -4303,32 +4305,37 @@ static bufferstackentry_t *pop_buffer(void)
pp_entry_t *ppp = pplookup(pp_incl_state.ppp); pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
if(ppp) if(ppp)
{ {
includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t)); iep = pp_xmalloc(sizeof(includelogicentry_t));
if(!iep) if (iep)
return NULL; {
iep->ppp = ppp;
iep->ppp = ppp; ppp->iep = iep;
ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename;
iep->filename = bufferstack[bufferstackidx].include_filename; iep->prev = NULL;
iep->prev = NULL; iep->next = pp_includelogiclist;
iep->next = pp_includelogiclist; if(iep->next)
if(iep->next) iep->next->prev = iep;
iep->next->prev = iep; pp_includelogiclist = iep;
pp_includelogiclist = iep; if(pp_status.debug)
if(pp_status.debug) fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n",
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
}
} }
else
free(bufferstack[bufferstackidx].include_filename);
} }
free(pp_incl_state.ppp); free(pp_incl_state.ppp);
pp_incl_state = bufferstack[bufferstackidx].incl; pp_incl_state = bufferstack[bufferstackidx].incl;
} }
if (bufferstack[bufferstackidx].include_filename)
{
free(pp_status.input);
pp_status.input = bufferstack[bufferstackidx].filename;
}
pp_status.line_number = bufferstack[bufferstackidx].line_number; pp_status.line_number = bufferstack[bufferstackidx].line_number;
pp_status.char_number = bufferstack[bufferstackidx].char_number; pp_status.char_number = bufferstack[bufferstackidx].char_number;
pp_status.input = bufferstack[bufferstackidx].filename;
ncontinuations = bufferstack[bufferstackidx].ncontinuations; ncontinuations = bufferstack[bufferstackidx].ncontinuations;
if (!iep)
free(bufferstack[bufferstackidx].include_filename);
} }
if(ppy_debug) if(ppy_debug)
@ -4538,6 +4545,7 @@ void pp_do_include(char *fname, int type)
* If the define was deleted, then this entry would have * If the define was deleted, then this entry would have
* been deleted too. * been deleted too.
*/ */
free(fname);
return; return;
} }
} }
@ -4547,6 +4555,7 @@ void pp_do_include(char *fname, int type)
if(n <= 2) if(n <= 2)
{ {
ppy_error("Empty include filename"); ppy_error("Empty include filename");
free(fname);
return; return;
} }
@ -4556,6 +4565,7 @@ void pp_do_include(char *fname, int type)
if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL) if((fp = pp_open_include(fname+1, type, pp_status.input, &newpath)) == NULL)
{ {
ppy_error("Unable to open include file %s", fname+1); ppy_error("Unable to open include file %s", fname+1);
free(fname);
return; return;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 2.5. */ /* A Bison parser, made by GNU Bison 3.0.2. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -26,71 +26,77 @@
special exception, which will cause the skeleton and the resulting special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public Bison output files to be licensed under the GNU General Public
License without this special exception. License without this special exception.
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
#ifndef YY_PPY_PPY_TAB_H_INCLUDED
/* Tokens. */ # define YY_PPY_PPY_TAB_H_INCLUDED
#ifndef YYTOKENTYPE /* Debug traces. */
# define YYTOKENTYPE #ifndef YYDEBUG
/* Put the tokens into the symbol table, so that GDB and other debuggers # define YYDEBUG 0
know about them. */ #endif
enum yytokentype { #if YYDEBUG
tRCINCLUDE = 258, extern int ppy_debug;
tIF = 259,
tIFDEF = 260,
tIFNDEF = 261,
tELSE = 262,
tELIF = 263,
tENDIF = 264,
tDEFINED = 265,
tNL = 266,
tINCLUDE = 267,
tLINE = 268,
tGCCLINE = 269,
tERROR = 270,
tWARNING = 271,
tPRAGMA = 272,
tPPIDENT = 273,
tUNDEF = 274,
tMACROEND = 275,
tCONCAT = 276,
tELIPSIS = 277,
tSTRINGIZE = 278,
tIDENT = 279,
tLITERAL = 280,
tMACRO = 281,
tDEFINE = 282,
tDQSTRING = 283,
tSQSTRING = 284,
tIQSTRING = 285,
tUINT = 286,
tSINT = 287,
tULONG = 288,
tSLONG = 289,
tULONGLONG = 290,
tSLONGLONG = 291,
tRCINCLUDEPATH = 292,
tLOGOR = 293,
tLOGAND = 294,
tNE = 295,
tEQ = 296,
tGTE = 297,
tLTE = 298,
tRSHIFT = 299,
tLSHIFT = 300
};
#endif #endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
tRCINCLUDE = 258,
tIF = 259,
tIFDEF = 260,
tIFNDEF = 261,
tELSE = 262,
tELIF = 263,
tENDIF = 264,
tDEFINED = 265,
tNL = 266,
tINCLUDE = 267,
tLINE = 268,
tGCCLINE = 269,
tERROR = 270,
tWARNING = 271,
tPRAGMA = 272,
tPPIDENT = 273,
tUNDEF = 274,
tMACROEND = 275,
tCONCAT = 276,
tELIPSIS = 277,
tSTRINGIZE = 278,
tIDENT = 279,
tLITERAL = 280,
tMACRO = 281,
tDEFINE = 282,
tDQSTRING = 283,
tSQSTRING = 284,
tIQSTRING = 285,
tUINT = 286,
tSINT = 287,
tULONG = 288,
tSLONG = 289,
tULONGLONG = 290,
tSLONGLONG = 291,
tRCINCLUDEPATH = 292,
tLOGOR = 293,
tLOGAND = 294,
tEQ = 295,
tNE = 296,
tLTE = 297,
tGTE = 298,
tLSHIFT = 299,
tRSHIFT = 300
};
#endif
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE typedef union YYSTYPE YYSTYPE;
union YYSTYPE
{ {
#line 126 "ppy.y" /* yacc.c:1909 */
/* Line 2068 of yacc.c */
#line 126 "ppy.y"
int sint; int sint;
unsigned int uint; unsigned int uint;
@ -104,16 +110,15 @@ typedef union YYSTYPE
marg_t *marg; marg_t *marg;
mtext_t *mtext; mtext_t *mtext;
#line 114 "ppy.tab.h" /* yacc.c:1909 */
};
/* Line 2068 of yacc.c */
#line 111 "ppy.tab.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
#endif #endif
extern YYSTYPE ppy_lval; extern YYSTYPE ppy_lval;
int ppy_parse (void);
#endif /* !YY_PPY_PPY_TAB_H_INCLUDED */

View file

@ -292,7 +292,7 @@ void pp_pop_define_state(void)
for (i = 0; i < HASHKEY; i++) for (i = 0; i < HASHKEY; i++)
{ {
while ((ppp = pp_def_state->defines[i]) != NULL) free_pp_entry( ppp, i ); while ((ppp = pp_def_state->defines[i]) != NULL) pp_del_define( ppp->ident );
} }
state = pp_def_state; state = pp_def_state;
pp_def_state = state->next; pp_def_state = state->next;
@ -302,6 +302,7 @@ void pp_pop_define_state(void)
void pp_del_define(const char *name) void pp_del_define(const char *name)
{ {
pp_entry_t *ppp; pp_entry_t *ppp;
int idx = pphash(name);
if((ppp = pplookup(name)) == NULL) if((ppp = pplookup(name)) == NULL)
{ {
@ -310,13 +311,13 @@ void pp_del_define(const char *name)
return; return;
} }
if(pp_status.debug)
printf("Deleting (%s, %d) <%s>\n", pp_status.input, pp_status.line_number, name);
free( ppp->ident ); free( ppp->ident );
free( ppp->subst.text ); free( ppp->subst.text );
free( ppp->filename ); free( ppp->filename );
free_pp_entry( ppp, pphash(name) ); free_pp_entry( ppp, idx );
if(pp_status.debug)
printf("Deleted (%s, %d) <%s>\n", pp_status.input, pp_status.line_number, name);
} }
pp_entry_t *pp_add_define(const char *def, const char *text) pp_entry_t *pp_add_define(const char *def, const char *text)

View file

@ -206,7 +206,7 @@ int wpp_parse( const char *input, FILE *output )
return 2; return 2;
} }
pp_status.input = input; pp_status.input = input ? pp_xstrdup(input) : NULL;
ppy_out = output; ppy_out = output;
pp_writestring("# 1 \"%s\" 1\n", input ? input : ""); pp_writestring("# 1 \"%s\" 1\n", input ? input : "");
@ -215,7 +215,11 @@ int wpp_parse( const char *input, FILE *output )
/* If there were errors during processing, return an error code */ /* If there were errors during processing, return an error code */
if (!ret && pp_status.state) ret = pp_status.state; if (!ret && pp_status.state) ret = pp_status.state;
if (input) wpp_callbacks->close(pp_status.file); if (input)
{
wpp_callbacks->close(pp_status.file);
free(pp_status.input);
}
/* Clean if_stack, it could remain dirty on errors */ /* Clean if_stack, it could remain dirty on errors */
while (pp_get_if_depth()) pp_pop_if(); while (pp_get_if_depth()) pp_pop_if();
del_special_defines(); del_special_defines();

View file

@ -228,7 +228,7 @@ void pp_internal_error(const char *file, int line, const char *s, ...) __attribu
/* everything is in this structure to avoid polluting the global symbol space */ /* everything is in this structure to avoid polluting the global symbol space */
struct pp_status struct pp_status
{ {
const char *input; /* current input file name */ char *input; /* current input file name */
void *file; /* current input file descriptor */ void *file; /* current input file descriptor */
int line_number; /* current line number */ int line_number; /* current line number */
int char_number; /* current char number in line */ int char_number; /* current char number in line */

View file

@ -1,20 +0,0 @@
Index: preproc.c
===================================================================
--- preproc.c (revision 28293)
+++ preproc.c (revision 28294)
@@ -328,6 +328,15 @@
char *tok;
char *cpy = pp_xstrdup(path);
+ /* check for absolute windows paths */
+ if (strchr(cpy, ':') != NULL)
+ {
+ nincludepath++;
+ includepath = pp_xrealloc(includepath, nincludepath * sizeof(*includepath));
+ includepath[nincludepath-1] = cpy;
+ return;
+ }
+
tok = strtok(cpy, INCLUDESEPARATOR);
while(tok)
{