Remove some unnecessary C-style statics.

Restore an assertion that arithmetic can be performed on this format.

llvm-svn: 43638
This commit is contained in:
Neil Booth 2007-11-02 15:10:05 +00:00
parent aa3229f2f1
commit cd1d243989
3 changed files with 115 additions and 85 deletions

View File

@ -121,7 +121,7 @@ namespace {
If the exponent overflows, returns a large exponent with the
appropriate sign. */
static int
int
readExponent(const char *p)
{
bool isNegative;
@ -159,7 +159,7 @@ namespace {
/* This is ugly and needs cleaning up, but I don't immediately see
how whilst remaining safe. */
static int
int
totalExponent(const char *p, int exponentAdjustment)
{
integerPart unsignedExponent;
@ -433,7 +433,7 @@ namespace {
/* Place pow(5, power) in DST, and return the number of parts used.
DST must be at least one part larger than size of the answer. */
static unsigned int
unsigned int
powerOf5(integerPart *dst, unsigned int power)
{
static integerPart firstEightPowers[] = { 1, 5, 25, 125, 625, 3125,
@ -504,7 +504,7 @@ namespace {
/* Write out an integerPart in hexadecimal, starting with the most
significant nibble. Write out exactly COUNT hexdigits, return
COUNT. */
static unsigned int
unsigned int
partAsHex (char *dst, integerPart part, unsigned int count,
const char *hexDigitChars)
{
@ -522,7 +522,7 @@ namespace {
}
/* Write out an unsigned decimal integer. */
static char *
char *
writeUnsignedDecimal (char *dst, unsigned int n)
{
char buff[40], *p;
@ -540,7 +540,7 @@ namespace {
}
/* Write out a signed decimal integer. */
static char *
char *
writeSignedDecimal (char *dst, int value)
{
if (value < 0) {
@ -1750,6 +1750,8 @@ APFloat::convertToSignExtendedInteger(integerPart *parts, unsigned int width,
const integerPart *src;
unsigned int dstPartsCount, truncatedBits;
assertArithmeticOK(*semantics);
/* Handle the three special cases first. */
if(category == fcInfinity || category == fcNaN)
return opInvalidOp;

View File

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

View File

@ -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]; }