Fix Mac OS-X compile issues, bug217.

This commit is contained in:
Wilson Snyder 2010-02-26 19:50:44 -05:00
parent 845d7ad718
commit 381972c923
4 changed files with 24 additions and 6 deletions

View File

@ -11,6 +11,8 @@ indicates the contributor was also the author of the fix; Thanks!
**** Skip SystemC tests if not installed. [Iztok Jeras]
**** Fix Mac OS-X compile issues, bug217. [Joshua Wise, Trevor Williams]
**** Fix make uninstall, bug216. [Iztok Jeras]
**** Fix parametrized defines with empty arguments.

View File

@ -121,6 +121,7 @@ HEADERS = $(wildcard V*.h v*.h)
ASTGEN = $(srcdir)/astgen
BISONPRE = $(srcdir)/bisonpre
FLEXFIX = $(srcdir)/flexfix
######################################################################
#### Top level
@ -296,15 +297,15 @@ V3Lexer_pregen.yy.cpp: verilog.l V3ParseBison.h $(HEADERS)
${LEX} --version
${LEX} ${LFLAGS} -o$@ $<
V3Lexer.yy.cpp: V3Lexer_pregen.yy.cpp
$(PERL) $(srcdir)/flexfix <$< >$@
V3Lexer.yy.cpp: V3Lexer_pregen.yy.cpp $(FLEXFIX)
$(PERL) $(FLEXFIX) V3Lexer <$< >$@
V3PreLex_pregen.yy.cpp: V3PreLex.l $(HEADERS)
${LEX} --version
${LEX} ${LFLAGS} -o$@ $<
V3PreLex.yy.cpp: V3PreLex_pregen.yy.cpp
$(PERL) $(srcdir)/flexfix <$< >$@
V3PreLex.yy.cpp: V3PreLex_pregen.yy.cpp $(FLEXFIX)
$(PERL) $(FLEXFIX) V3PreLex <$< >$@
######################################################################
######################################################################

View File

@ -90,19 +90,28 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
# define YY_BUF_SIZE 16384
#endif
// Older flex'es don't have this defined, so make everyone happy
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif
extern int yylex();
extern void yyrestart(FILE*);
extern char* yytext;
extern int yyleng;
extern yy_size_t yyleng;
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer );
void yy_delete_buffer( YY_BUFFER_STATE b );
//======================================================================
// Class entry for each per-lexter state
#define KEEPCMT_SUB 2
//======================================================================
// Class entry for each per-lexter state
class V3PreLex {
public: // Used only by V3PreLex.cpp and V3PreProc.cpp
FileLine* m_curFilelinep; // Current processing point

View File

@ -15,6 +15,8 @@
# DESCRIPTION: Edits flex output to get around various broken flex issues.
my $Opt_Prefix = $ARGV[0] or die "%Error: No prefix specified,";
foreach my $line (<STDIN>) {
# Fix flex 2.5.4 namespace omission
$line =~ s/^class istream;/\#include <iostream>\nusing namespace std;\n/;
@ -28,6 +30,10 @@ foreach my $line (<STDIN>) {
$line =~ s!for \( n = 0; n < max_size && !for ( n = 0; ((size_t)n < (size_t)max_size) && !g;
# Fix flex 2.5.4 and GCC 4.0.2 under FLEX_DEBUG
$line =~ s!--accepting rule at line %d !--accepting rule at line %ld !g;
# Fix flex 2.5.35 to match patches on Mac OS-X
$line =~ s!(extern |)int (${Opt_Prefix}leng;)!#ifndef YY_TYPEDEF_YY_SIZE_T\n#define YY_TYPEDEF_YY_SIZE_T\ntypedef size_t yy_size_t;\n#endif\n$1yy_size_t $2;!;
# Fix compiler warning filenames
$line =~ s!(#line \d+ ".*)_pretmp!$1!;
print "$line";
}