wpp: Don't suppress output from C include files, that's up to the user.
This commit is contained in:
parent
549351ab09
commit
49a3d4371d
|
@ -200,7 +200,6 @@ typedef struct bufferstackentry {
|
||||||
/* Include management */
|
/* Include management */
|
||||||
include_state_t incl;
|
include_state_t incl;
|
||||||
char *include_filename;
|
char *include_filename;
|
||||||
int pass_data;
|
|
||||||
} bufferstackentry_t;
|
} bufferstackentry_t;
|
||||||
|
|
||||||
#define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */
|
#define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */
|
||||||
|
@ -233,7 +232,6 @@ typedef struct macexpstackentry {
|
||||||
static void newline(int);
|
static void newline(int);
|
||||||
static int make_number(int radix, YYSTYPE *val, const char *str, int len);
|
static int make_number(int radix, YYSTYPE *val, const char *str, int len);
|
||||||
static void put_buffer(const char *s, int len);
|
static void put_buffer(const char *s, int len);
|
||||||
static int is_c_h_include(char *fname, int quoted);
|
|
||||||
/* Buffer management */
|
/* Buffer management */
|
||||||
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
|
static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
|
||||||
static bufferstackentry_t *pop_buffer(void);
|
static bufferstackentry_t *pop_buffer(void);
|
||||||
|
@ -272,8 +270,6 @@ static int macexpstackidx = 0;
|
||||||
static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
|
static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
|
||||||
static int bufferstackidx = 0;
|
static int bufferstackidx = 0;
|
||||||
|
|
||||||
static int pass_data=1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
@ -559,8 +555,6 @@ includelogicentry_t *pp_includelogiclist = NULL;
|
||||||
return tDQSTRING;
|
return tDQSTRING;
|
||||||
case pp_line:
|
case pp_line:
|
||||||
ppy_lval.cptr = get_string();
|
ppy_lval.cptr = get_string();
|
||||||
if (is_c_h_include(ppy_lval.cptr, 1)) pass_data=0;
|
|
||||||
else pass_data=1;
|
|
||||||
return tDQSTRING;
|
return tDQSTRING;
|
||||||
default:
|
default:
|
||||||
put_string();
|
put_string();
|
||||||
|
@ -1191,7 +1185,6 @@ static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
|
||||||
bufferstack[bufferstackidx].ncontinuations = ncontinuations;
|
bufferstack[bufferstackidx].ncontinuations = ncontinuations;
|
||||||
bufferstack[bufferstackidx].incl = pp_incl_state;
|
bufferstack[bufferstackidx].incl = pp_incl_state;
|
||||||
bufferstack[bufferstackidx].include_filename = incname;
|
bufferstack[bufferstackidx].include_filename = incname;
|
||||||
bufferstack[bufferstackidx].pass_data = pass_data;
|
|
||||||
|
|
||||||
if(ppp)
|
if(ppp)
|
||||||
ppp->expanding = 1;
|
ppp->expanding = 1;
|
||||||
|
@ -1254,7 +1247,6 @@ static bufferstackentry_t *pop_buffer(void)
|
||||||
}
|
}
|
||||||
free(pp_incl_state.ppp);
|
free(pp_incl_state.ppp);
|
||||||
pp_incl_state = bufferstack[bufferstackidx].incl;
|
pp_incl_state = bufferstack[bufferstackidx].incl;
|
||||||
pass_data = bufferstack[bufferstackidx].pass_data;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1410,10 +1402,8 @@ static void put_buffer(const char *s, int len)
|
||||||
{
|
{
|
||||||
if(top_macro())
|
if(top_macro())
|
||||||
add_text_to_macro(s, len);
|
add_text_to_macro(s, len);
|
||||||
else {
|
else
|
||||||
if(pass_data)
|
|
||||||
fwrite(s, 1, len, ppy_out);
|
fwrite(s, 1, len, ppy_out);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1422,15 +1412,6 @@ static void put_buffer(const char *s, int len)
|
||||||
* Include management
|
* Include management
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static int is_c_h_include(char *fname, int quoted)
|
|
||||||
{
|
|
||||||
int sl=strlen(fname);
|
|
||||||
if (sl < 2 + 2 * quoted) return 0;
|
|
||||||
if ((toupper(fname[sl-1-quoted])!='H') && (toupper(fname[sl-1-quoted])!='C')) return 0;
|
|
||||||
if (fname[sl-2-quoted]!='.') return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pp_do_include(char *fname, int type)
|
void pp_do_include(char *fname, int type)
|
||||||
{
|
{
|
||||||
char *newpath;
|
char *newpath;
|
||||||
|
@ -1466,12 +1447,10 @@ void pp_do_include(char *fname, int type)
|
||||||
pp_incl_state.seen_junk = 0;
|
pp_incl_state.seen_junk = 0;
|
||||||
pp_incl_state.state = 0;
|
pp_incl_state.state = 0;
|
||||||
pp_incl_state.ppp = NULL;
|
pp_incl_state.ppp = NULL;
|
||||||
if (is_c_h_include(newpath, 0)) pass_data=0;
|
|
||||||
else pass_data=1;
|
|
||||||
|
|
||||||
if(pp_status.debug)
|
if(pp_status.debug)
|
||||||
fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d ,pass_data=%d\n",
|
fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n",
|
||||||
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth, pass_data);
|
pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth);
|
||||||
ppy__switch_to_buffer(ppy__create_buffer(ppy_in, YY_BUF_SIZE));
|
ppy__switch_to_buffer(ppy__create_buffer(ppy_in, YY_BUF_SIZE));
|
||||||
|
|
||||||
fprintf(ppy_out, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
|
fprintf(ppy_out, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
|
||||||
|
|
Loading…
Reference in New Issue