
2014-05-23 Richard Biener <rguenther@suse.de> * system.h: Define __STDC_FORMAT_MACROS before including inttypes.h. * hwint.h (HOST_WIDEST_INT, HOST_BITS_PER_WIDEST_INT, HOST_WIDEST_INT_PRINT, HOST_WIDEST_INT_PRINT_DEC, HOST_WIDEST_INT_PRINT_DEC_C, HOST_WIDEST_INT_PRINT_UNSIGNED, HOST_WIDEST_INT_PRINT_HEX, HOST_WIDEST_INT_PRINT_DOUBLE_HEX, HOST_WIDEST_INT_C): Remove. (PRId64, PRIi64, PRIo64, PRIu64, PRIx64, PRIX64): Define if C99 inttypes.h is not available. * coretypes.h (gcov_type, gcov_type_unsigned): Use [u]int64_t. * gcov-io.h (gcov_type, gcov_type_unsigned): Likewise. * gcov-io.c (gcov_histo_index): Drop non-64bit hwi case. * cfgloop.h (struct niter_desc): Use uint64_t for niter field. * bitmap.c (struct bitmap_descriptor_d): Use uint64_t for counters. (struct output_info): Likewise. (print_statistics): Adjust. (dump_bitmap_statistics): Likewise. * bt-load.c (migrate_btr_defs): Print with PRId64. * cfg.c (dump_edge_info, dump_bb_info): Likewise. (MAX_SAFE_MULTIPLIER): Adjust. * cfghooks.c (dump_bb_for_graph): Print with PRId64. * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee, dump_cgraph_node): Likewise. * final.c (dump_basic_block_info): Likewise. * gcov-dump.c (tag_counters, tag_summary, dump_working_sets): Likewise. * gcov.c (format_gcov): Likewise. * ipa-cp.c (good_cloning_opportunity_p): Likewise. Use int64_t for calculation. (get_clone_agg_value): Use HOST_WIDE_INT for offset. * ipa-inline.c (compute_max_insns): Use int64_t for calcuation. (inline_small_functions, dump_overall_stats, dump_inline_stats): Use PRId64 for dumping. * ipa-profile.c (dump_histogram, ipa_profile): Likewise. * ira-color.c (struct allocno_hard_regs): Use int64_t for cost. (add_allocno_hard_regs): Adjust. * loop-doloop.c (doloop_modify): Print using PRId64. * loop-iv.c (inverse): Compute in uint64_t. (determine_max_iter, iv_number_of_iterations): Likewise. * loop-unroll.c (decide_peel_completely, decide_peel_simple): Print using PRId64. * lto-streamer-out.c (write_symbol): Use uint64_t. * mcf.c (CAP_INFINITY): Use int64_t maximum. (dump_fixup_edge, create_fixup_graph, cancel_negative_cycle, find_max_flow, adjust_cfg_counts): Use int64_t and dump with PRId64. * modulo-sched.c (const_iteration_count): Use int64_t. (sms_schedule): Dump using PRId64. * predict.c (dump_prediction): Likewise. * pretty-print.h (pp_widest_integer): Remove. * profile.c (get_working_sets, is_edge_inconsistent, is_inconsistent, read_profile_edge_counts): Dump using PRId64. * tree-pretty-print.c (pp_double_int): Remove case handling HOST_BITS_PER_DOUBLE_INT == HOST_BITS_PER_WIDEST_INT. * tree-ssa-math-opts.c (struct symbolic_number): Use uint64_t and adjust users. (pass_optimize_bswap::execute): Remove restriction on hosts. * tree-streamer-in.c (streamer_alloc_tree): Use HOST_WIDE_INT. * tree-streamer-out.c (streamer_write_tree_header): Likewise. * tree.c (widest_int_cst_value): Remove. * tree.h (widest_int_cst_value): Likewise. * value-prof.c (dump_histogram_value): Print using PRId64. * gengtype.c (main): Also inject int64_t. * ggc-page.c (struct max_alignment): Use int64_t. * alloc-pool.c (struct allocation_object_def): Likewise. * ira-conflicts.c (build_conflict_bit_table): Use uint64_t for computation. * doc/tm.texi.in: Remove reference to HOST_WIDEST_INT. * doc/tm.texi: Regenerated. * gengtype-lex.l (IWORD): Handle [u]int64_t. * config/sh/sh.c (expand_cbranchdi4): Use gcov_type. * config/mmix/mmix-protos.h (mmix_intval, mmix_shiftable_wyde_value, mmix_output_register_setting): Use [u]int64_t in prototypes. * config/mmix/mmix.c (mmix_print_operand, mmix_output_register_setting, mmix_shiftable_wyde_value, mmix_output_shiftvalue_op_from_str, mmix_output_octa, mmix_output_shifted_value): Adjust. (mmix_intval): Adjust. Remove unreachable case. * config/mmix/mmix.md (*nonlocal_goto_receiver_expanded): Use int64_t. lto/ * lto.c (lto_parse_hex): Use int64_t. (lto_resolution_read): Likewise. From-SVN: r210931
221 lines
5 KiB
Text
221 lines
5 KiB
Text
/* -*- indented-text -*- */
|
|
/* Process source files and output type information.
|
|
Copyright (C) 2002-2014 Free Software Foundation, Inc.
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free
|
|
Software Foundation; either version 3, or (at your option) any later
|
|
version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
%option noinput
|
|
|
|
%{
|
|
#ifdef GENERATOR_FILE
|
|
#include "bconfig.h"
|
|
#else
|
|
#include "config.h"
|
|
#endif
|
|
#include "system.h"
|
|
|
|
#define malloc xmalloc
|
|
#define realloc xrealloc
|
|
|
|
#include "gengtype.h"
|
|
|
|
#define YY_DECL int yylex (const char **yylval)
|
|
#define yyterminate() return EOF_TOKEN
|
|
|
|
struct fileloc lexer_line;
|
|
int lexer_toplevel_done;
|
|
|
|
static void
|
|
update_lineno (const char *l, size_t len)
|
|
{
|
|
while (len-- > 0)
|
|
if (*l++ == '\n')
|
|
lexer_line.line++;
|
|
}
|
|
|
|
%}
|
|
|
|
CID [[:alpha:]_][[:alnum:]_]*
|
|
WS [[:space:]]+
|
|
HWS [ \t\r\v\f]*
|
|
IWORD short|long|(un)?signed|char|int|HOST_WIDE_INT|uint64_t|int64_t|bool|size_t|BOOL_BITFIELD|CPPCHAR_SIGNED_T|ino_t|dev_t|HARD_REG_SET
|
|
ITYPE {IWORD}({WS}{IWORD})*
|
|
/* Include '::' in identifiers to capture C++ scope qualifiers. */
|
|
ID {CID}({HWS}::{HWS}{CID})*
|
|
EOID [^[:alnum:]_]
|
|
CXX_KEYWORD inline|public:|private:|protected:|template|operator|friend|static
|
|
|
|
%x in_struct in_struct_comment in_comment
|
|
%option warn noyywrap nounput nodefault perf-report
|
|
%option 8bit never-interactive
|
|
%%
|
|
/* Do this on entry to yylex(): */
|
|
*yylval = 0;
|
|
if (lexer_toplevel_done)
|
|
{
|
|
BEGIN(INITIAL);
|
|
lexer_toplevel_done = 0;
|
|
}
|
|
|
|
/* Things we look for in skipping mode: */
|
|
<INITIAL>{
|
|
^{HWS}typedef/{EOID} {
|
|
BEGIN(in_struct);
|
|
return TYPEDEF;
|
|
}
|
|
^{HWS}struct/{EOID} {
|
|
BEGIN(in_struct);
|
|
return STRUCT;
|
|
}
|
|
^{HWS}union/{EOID} {
|
|
BEGIN(in_struct);
|
|
return UNION;
|
|
}
|
|
^{HWS}class/{EOID} {
|
|
BEGIN(in_struct);
|
|
return STRUCT;
|
|
}
|
|
^{HWS}extern/{EOID} {
|
|
BEGIN(in_struct);
|
|
return EXTERN;
|
|
}
|
|
^{HWS}static/{EOID} {
|
|
BEGIN(in_struct);
|
|
return STATIC;
|
|
}
|
|
}
|
|
|
|
/* Parsing inside a struct, union or class declaration. */
|
|
<in_struct>{
|
|
"/*" { BEGIN(in_struct_comment); }
|
|
"//".*\n { lexer_line.line++; }
|
|
|
|
{WS} { update_lineno (yytext, yyleng); }
|
|
\\\n { lexer_line.line++; }
|
|
|
|
"const"/{EOID} /* don't care */
|
|
{CXX_KEYWORD}/{EOID} |
|
|
"~" |
|
|
"^" |
|
|
"&" {
|
|
*yylval = XDUPVAR (const char, yytext, yyleng, yyleng + 1);
|
|
return IGNORABLE_CXX_KEYWORD;
|
|
}
|
|
"GTY"/{EOID} { return GTY_TOKEN; }
|
|
"union"/{EOID} { return UNION; }
|
|
"struct"/{EOID} { return STRUCT; }
|
|
"class"/{EOID} { return STRUCT; }
|
|
"typedef"/{EOID} { return TYPEDEF; }
|
|
"enum"/{EOID} { return ENUM; }
|
|
"ptr_alias"/{EOID} { return PTR_ALIAS; }
|
|
"nested_ptr"/{EOID} { return NESTED_PTR; }
|
|
"user"/{EOID} { return USER_GTY; }
|
|
[0-9]+ { return NUM; }
|
|
"param"[0-9]*"_is"/{EOID} {
|
|
*yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
|
|
return PARAM_IS;
|
|
}
|
|
|
|
{IWORD}({WS}{IWORD})*/{EOID} |
|
|
"ENUM_BITFIELD"{WS}?"("{WS}?{ID}{WS}?")" {
|
|
size_t len;
|
|
|
|
for (len = yyleng; ISSPACE (yytext[len-1]); len--)
|
|
;
|
|
|
|
*yylval = XDUPVAR (const char, yytext, len, len+1);
|
|
update_lineno (yytext, yyleng);
|
|
return SCALAR;
|
|
}
|
|
|
|
{ID}/{EOID} {
|
|
*yylval = XDUPVAR (const char, yytext, yyleng, yyleng+1);
|
|
return ID;
|
|
}
|
|
|
|
\"([^"\\]|\\.)*\" {
|
|
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
|
|
return STRING;
|
|
}
|
|
/* This "terminal" avoids having to parse integer constant expressions. */
|
|
"["[^\[\]]*"]" {
|
|
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng-1);
|
|
return ARRAY;
|
|
}
|
|
"'"("\\".|[^\\])"'" {
|
|
*yylval = XDUPVAR (const char, yytext+1, yyleng-2, yyleng);
|
|
return CHAR;
|
|
}
|
|
|
|
"..." { return ELLIPSIS; }
|
|
[(){},*:<>;=%|+\!\?\.-] { return yytext[0]; }
|
|
|
|
/* ignore pp-directives */
|
|
^{HWS}"#"{HWS}[a-z_]+[^\n]*\n {lexer_line.line++;}
|
|
|
|
. {
|
|
error_at_line (&lexer_line, "unexpected character `%s'", yytext);
|
|
}
|
|
}
|
|
|
|
"/*" { BEGIN(in_comment); }
|
|
"//".*\n { lexer_line.line++; }
|
|
\n { lexer_line.line++; }
|
|
{ID} |
|
|
"'"("\\".|[^\\])"'" |
|
|
[^"/\n] /* do nothing */
|
|
\"([^"\\]|\\.|\\\n)*\" { update_lineno (yytext, yyleng); }
|
|
"/"/[^*] /* do nothing */
|
|
|
|
<in_comment,in_struct_comment>{
|
|
\n { lexer_line.line++; }
|
|
[^*\n]{16} |
|
|
[^*\n] /* do nothing */
|
|
"*"/[^/] /* do nothing */
|
|
}
|
|
|
|
<in_comment>"*/" { BEGIN(INITIAL); }
|
|
<in_struct_comment>"*/" { BEGIN(in_struct); }
|
|
|
|
["/] |
|
|
<in_struct_comment,in_comment>"*" {
|
|
error_at_line (&lexer_line,
|
|
"unterminated comment or string; unexpected EOF");
|
|
}
|
|
|
|
^{HWS}"#"{HWS}"define"{WS}"GTY(" /* do nothing */
|
|
|
|
%%
|
|
|
|
void
|
|
yybegin (const char *fname)
|
|
{
|
|
yyin = fopen (fname, "r");
|
|
if (yyin == NULL)
|
|
{
|
|
perror (fname);
|
|
exit (1);
|
|
}
|
|
lexer_line.file = input_file_by_name (fname);
|
|
lexer_line.line = 1;
|
|
}
|
|
|
|
void
|
|
yyend (void)
|
|
{
|
|
fclose (yyin);
|
|
}
|