summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2007-11-02 15:10:05 +0000
committerNeil Booth <neil@daikokuya.co.uk>2007-11-02 15:10:05 +0000
commite3d936ac9ce56acfeb058f573e6c6ce0682ed781 (patch)
treea782359c2f6c78f97a3a11299dbe9ef717c7d867 /utils
parentb5d81b3e66770d6158333f8222054372bd6278d8 (diff)
downloadllvm-e3d936ac9ce56acfeb058f573e6c6ce0682ed781.tar.gz
llvm-e3d936ac9ce56acfeb058f573e6c6ce0682ed781.tar.bz2
llvm-e3d936ac9ce56acfeb058f573e6c6ce0682ed781.tar.xz
Remove some unnecessary C-style statics.
Restore an assertion that arithmetic can be performed on this format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/FileLexer.cpp.cvs170
-rw-r--r--utils/TableGen/FileLexer.l.cvs16
2 files changed, 107 insertions, 79 deletions
diff --git a/utils/TableGen/FileLexer.cpp.cvs b/utils/TableGen/FileLexer.cpp.cvs
index a4361405a5..be356517ff 100644
--- a/utils/TableGen/FileLexer.cpp.cvs
+++ b/utils/TableGen/FileLexer.cpp.cvs
@@ -21,7 +21,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
- * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $
+ * $NetBSD: flex.skl,v 1.22 2005/08/08 01:28:08 christos Exp $
*/
#define FLEX_SCANNER
@@ -257,11 +257,11 @@ void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, yy_size_t len ));
+#ifdef __cplusplus
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, int size ));
YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
+#endif
#define yy_new_buffer yy_create_buffer
@@ -291,6 +291,14 @@ int yylineno = 1;
extern char *yytext;
#define yytext_ptr yytext
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ))
+#ifdef __GNUC__
+ __attribute__((__unused__))
+#endif
+;
+static void yy_flex_free YY_PROTO(( void * ));
+
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
static int yy_get_next_buffer YY_PROTO(( void ));
@@ -502,7 +510,7 @@ goto find_rule; \
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
-#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 1 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
#define INITIAL 0
/*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
//
@@ -518,9 +526,9 @@ char *yytext;
//
//===----------------------------------------------------------------------===*/
#define YY_NEVER_INTERACTIVE 1
-#define comment 1
+#define in_comment 1
-#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 30 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
#include "llvm/Config/config.h"
#include "llvm/Support/Streams.h"
#include "Record.h"
@@ -666,7 +674,7 @@ int yywrap(void) {
using namespace llvm;
-#line 670 "Lexer.cpp"
+#line 678 "Lexer.cpp"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -681,15 +689,19 @@ extern int yywrap YY_PROTO(( void ));
#endif
#ifndef YY_NO_UNPUT
-static inline void yyunput YY_PROTO(( int c, char *buf_ptr ));
+static inline void yyunput YY_PROTO(( int c, char *buf_ptr ))
+#ifdef __GNUC__
+ __attribute__((__unused__))
+#endif
+;
#endif
#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, yy_size_t ));
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+static yy_size_t yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
@@ -746,7 +758,7 @@ YY_MALLOC_DECL
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#define ECHO (void) fwrite( yytext, (size_t)yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -766,7 +778,7 @@ YY_MALLOC_DECL
YY_FATAL_ERROR( "input in flex scanner failed" ); \
result = n; \
} \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ else if ( ((result = fread( buf, 1, (size_t)max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
YY_FATAL_ERROR( "input in flex scanner failed" );
#endif
@@ -805,7 +817,7 @@ YY_MALLOC_DECL
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
#endif
#define YY_RULE_SETUP \
@@ -817,11 +829,16 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 185 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
-#line 824 "Lexer.cpp"
+#line 836 "Lexer.cpp"
+#if defined(YY_USES_REJECT) && (defined(__GNUC__) || defined(lint))
+ /* XXX: shut up `unused label' warning with %options yylineno */
+ if (/*CONSTCOND*/0 && yy_full_match)
+ goto find_rule;
+#endif
if ( yy_init )
{
yy_init = 0;
@@ -846,7 +863,7 @@ YY_DECL
yy_load_buffer_state();
}
- while ( 1 ) /* loops until end-of-file is reached */
+ while (/*CONSTCOND*/ 1 ) /* loops until end-of-file is reached */
{
yy_cp = yy_c_buf_p;
@@ -913,188 +930,188 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 187 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ /* Ignore comments */ }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 189 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ HandleInclude(yytext); }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 190 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
return CODEFRAGMENT; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 193 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return INT; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 194 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return BIT; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 195 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return BITS; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 196 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return STRING; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 197 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return LIST; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 198 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return CODE; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 199 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return DAG; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 201 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return CLASS; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 202 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return DEF; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 203 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return DEFM; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 204 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return MULTICLASS; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 205 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return FIELD; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 206 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return LET; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 207 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return IN; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 209 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return CONCATTOK; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 210 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return SRATOK; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 211 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return SRLTOK; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 212 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return SHLTOK; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 213 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return STRCONCATTOK; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 216 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext, yytext+yyleng);
return ID; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 218 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
return VARNAME; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 221 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
return STRVAL; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 224 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 226 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
-{ BEGIN(comment); CommentDepth++; }
+#line 229 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
+{ BEGIN(in_comment); CommentDepth++; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 230 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{} /* eat anything that's not a '*' or '/' */
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 231 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{} /* eat up '*'s not followed by '/'s */
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 232 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ ++CommentDepth; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 233 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{} /* eat up /'s not followed by *'s */
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 234 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ if (!--CommentDepth) { BEGIN(INITIAL); } }
YY_BREAK
-case YY_STATE_EOF(comment):
-#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+case YY_STATE_EOF(in_comment):
+#line 235 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ err() << "Unterminated comment!\n"; exit(1); }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 237 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
{ return Filetext[0]; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 239 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 1098 "Lexer.cpp"
+#line 1115 "Lexer.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1513,7 +1530,7 @@ static int input()
/* Reset buffer status. */
yyrestart( yyin );
- /* fall through */
+ /*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
@@ -1658,7 +1675,7 @@ YY_BUFFER_STATE b;
#ifndef YY_ALWAYS_INTERACTIVE
#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
+#include <unistd.h>
#endif
#endif
@@ -1754,6 +1771,12 @@ yy_size_t size;
return b;
}
+#ifdef __cplusplus
+YY_BUFFER_STATE yy_scan_buffer( char *base, int size )
+ {
+ return yy_scan_buffer(base, (yy_size_t) size);
+ }
+#endif
#endif
@@ -1765,7 +1788,7 @@ YY_BUFFER_STATE yy_scan_string( yy_str )
yyconst char *yy_str;
#endif
{
- int len;
+ yy_size_t len;
for ( len = 0; yy_str[len]; ++len )
;
@@ -1776,17 +1799,16 @@ yyconst char *yy_str;
#ifndef YY_NO_SCAN_BYTES
#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, yy_size_t len )
#else
YY_BUFFER_STATE yy_scan_bytes( bytes, len )
yyconst char *bytes;
-int len;
+yy_size_t len;
#endif
{
YY_BUFFER_STATE b;
char *buf;
- yy_size_t n;
- int i;
+ yy_size_t n, i;
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
@@ -1810,6 +1832,12 @@ int len;
return b;
}
+#ifdef __cplusplus
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *base, int size )
+ {
+ return yy_scan_bytes(base, (yy_size_t) size);
+ }
+#endif
#endif
@@ -1902,15 +1930,15 @@ char msg[];
#ifndef yytext_ptr
#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+static void yy_flex_strncpy( char *s1, yyconst char *s2, yy_size_t n )
#else
static void yy_flex_strncpy( s1, s2, n )
char *s1;
yyconst char *s2;
-int n;
+yy_size_t n;
#endif
{
- register int i;
+ register yy_size_t i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -1918,13 +1946,13 @@ int n;
#ifdef YY_NEED_STRLEN
#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
+static yy_size_t yy_flex_strlen( yyconst char *s )
#else
-static int yy_flex_strlen( s )
+static yy_size_t yy_flex_strlen( s )
yyconst char *s;
#endif
{
- register int n;
+ register yy_size_t n;
for ( n = 0; s[n]; ++n )
;
@@ -1978,6 +2006,6 @@ int main()
return 0;
}
#endif
-#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
+#line 239 "/home/neil/src/nobackup/llvm/utils/TableGen/FileLexer.l"
diff --git a/utils/TableGen/FileLexer.l.cvs b/utils/TableGen/FileLexer.l.cvs
index 59bbdad7bf..561e8a1317 100644
--- a/utils/TableGen/FileLexer.l.cvs
+++ b/utils/TableGen/FileLexer.l.cvs
@@ -24,7 +24,7 @@
%option noreject
%option noyymore
-%x comment
+%x in_comment
%{
#include "llvm/Config/config.h"
@@ -226,13 +226,13 @@ ${Identifier} { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
[ \t\n\r]+ { /* Ignore whitespace */ }
-"/*" { BEGIN(comment); CommentDepth++; }
-<comment>[^*/]* {} /* eat anything that's not a '*' or '/' */
-<comment>"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */
-<comment>"/*" { ++CommentDepth; }
-<comment>"/"+[^*/]* {} /* eat up /'s not followed by *'s */
-<comment>"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
-<comment><<EOF>> { err() << "Unterminated comment!\n"; exit(1); }
+"/*" { BEGIN(in_comment); CommentDepth++; }
+<in_comment>[^*/]* {} /* eat anything that's not a '*' or '/' */
+<in_comment>"*"+[^*/]* {} /* eat up '*'s not followed by '/'s */
+<in_comment>"/*" { ++CommentDepth; }
+<in_comment>"/"+[^*/]* {} /* eat up /'s not followed by *'s */
+<in_comment>"*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } }
+<in_comment><<EOF>> { err() << "Unterminated comment!\n"; exit(1); }
. { return Filetext[0]; }