Fixes for gcc 4.3.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 03:41:33 +0000 (03:41 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 03:41:33 +0000 (03:41 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@376 052ea7fc-9027-0410-9066-f65837a77df0

20 files changed:
test/call2.rl
test/cond2.rl
test/cond3.rl
test/cond5.rl
test/cond6.rl
test/cppscan1.h
test/cppscan1.rl
test/cppscan2.rl
test/cppscan3.rl
test/element1.rl
test/erract1.rl
test/lmgoto.rl
test/mailbox1.h
test/mailbox1.rl
test/mailbox2.rl
test/mailbox3.rl
test/repetition.rl
test/rlscan.rl
test/runtests
test/union.rl

index e6811fb..a553855 100644 (file)
@@ -81,7 +81,7 @@ int CallTest::finish( )
 
 #define BUFSIZE 1024
 
-void test( char *buf )
+void test( const char *buf )
 {   
        CallTest test;
 
index 7593a3f..7e49ab8 100644 (file)
@@ -25,11 +25,11 @@ using std::endl;
 
 %% write data noerror;
 
-void test( int i, int j, char *str )
+void test( int i, int j, const char *str )
 {
        int cs = foo_start;
-       char *p = str;
-       char *pe = str + strlen( str );
+       const char *p = str;
+       const char *pe = str + strlen( str );
 
        cout << "run:" << endl;
        %% write exec;
index 1847727..80904b5 100644 (file)
@@ -20,12 +20,12 @@ using std::endl;
 
 %% write data noerror;
 
-void test( char *str )
+void test( const char *str )
 {
        int cs = foo_start;
        int c = 0;
-       char *p = str;
-       char *pe = str + strlen( str );
+       const char *p = str;
+       const char *pe = str + strlen( str );
 
        cout << "run:" << endl;
        %% write exec;
index 57e3c85..b6ab4ae 100644 (file)
@@ -12,12 +12,12 @@ using std::endl;
        write data noerror;
 }%%
 
-void test( char *str )
+void test( const char *str )
 {
        int cs = foo_start;
        int c = 0;
-       char *p = str;
-       char *pe = str + strlen( str );
+       const char *p = str;
+       const char *pe = str + strlen( str );
        char last = '0';
 
        cout << "run:";
index 25bf45d..ede9ed8 100644 (file)
@@ -14,11 +14,11 @@ using std::endl;
        write data noerror;
 }%%
 
-void test( char *str )
+void test( const char *str )
 {
        int cs = cond_start, n = 0;
-       char *p = str;
-       char *pe = str + strlen( str );
+       const char *p = str;
+       const char *pe = str + strlen( str );
 
        %%{
                comment = '(' @{n=0;} 
index 4497cd2..3fa0229 100644 (file)
@@ -2,6 +2,8 @@
 #define _CPPSCAN1_H
 
 #include <iostream>
+#include <malloc.h>
+#include <string.h>
 
 using namespace std;
 
@@ -98,7 +100,7 @@ struct Scanner
        // the data, the machine is in the error state and can never accept, 0 if
        // the machine is in a non-accepting state and 1 if the machine is in an
        // accepting state.
-       int execute( char *data, int len );
+       int execute( const char *data, int len );
 
        // Indicate that there is no more data. Returns -1 if the machine finishes
        // in the error state and does not accept, 0 if the machine finishes
index 8c87f78..92869f7 100644 (file)
@@ -131,12 +131,12 @@ void Scanner::init( )
        %% write init;
 }
 
-int Scanner::execute( char *data, int len )
+int Scanner::execute( const char *data, int len )
 {
        Scanner *fsm = this;
-       char *p = data;
-       char *pe = data + len;
-       char *eof = pe;
+       const char *p = data;
+       const char *pe = data + len;
+       const char *eof = pe;
 
        %% write exec;
        if ( cs == Scanner_error )
@@ -190,7 +190,7 @@ void Buffer::upAllocate( int len )
        allocated = len;
 }
 
-void test( char *buf )
+void test( const char *buf )
 {
        Scanner scanner(cout);
        scanner.init();
index 78efe20..d719830 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <iostream>
+#include <string.h>
 using namespace std;
 
 #define TK_Dlit 192
@@ -39,8 +40,9 @@ using namespace std;
 #define BUFSIZE 4096
 
 int tok;
-char buf[BUFSIZE], *tokstart, *tokend;
-void token( char *data, int len );
+char buf[BUFSIZE];
+const char *tokstart, *tokend;
+void token( const char *data, int len );
 bool discard = false;
 
 struct Scanner
@@ -56,7 +58,7 @@ struct Scanner
        // the data, the machine is in the error state and can never accept, 0 if
        // the machine is in a non-accepting state and 1 if the machine is in an
        // accepting state.
-       int execute( char *data, int len );
+       int execute( const char *data, int len );
 
        // Indicate that there is no more data. Returns -1 if the machine finishes
        // in the error state and does not accept, 0 if the machine finishes
@@ -141,7 +143,7 @@ struct Scanner
 
        action onError {
                if ( tok != 0 ) {
-                       char *rst_data;
+                       const char *rst_data;
 
                        if ( tok == TK_Comment || tok == TK_Whitespace ) {
                                /* Reset comment status, don't send. */
@@ -180,11 +182,11 @@ int Scanner::init( )
        return 1;
 }
 
-int Scanner::execute( char *data, int len )
+int Scanner::execute( const char *data, int len )
 {
-       char *p = data;
-       char *pe = data + len;
-       char *eof = pe;
+       const char *p = data;
+       const char *pe = data + len;
+       const char *eof = pe;
 
        %% write exec;
 
@@ -205,7 +207,7 @@ int Scanner::finish( )
 }
 
 
-void token( char *data, int len )
+void token( const char *data, int len )
 {
        cout << "<" << tok << "> ";
        for ( int i = 0; i < len; i++ )
@@ -213,7 +215,7 @@ void token( char *data, int len )
        cout << '\n';
 }
 
-void test( char * data )
+void test( const char * data )
 {
        Scanner scanner;
        scanner.init();
index 1dacb1f..15a80ac 100644 (file)
@@ -44,13 +44,13 @@ char buf[BUFSIZE];
 struct Scanner
 {
        int cs, act;
-       char *tokstart, *tokend;
+       const char *tokstart, *tokend;
 
        void token( int tok );
        void run();
 
        void init( );
-       void execute( char *data, int len );
+       void execute( const char *data, int len );
        int finish( );
 };
 
@@ -137,11 +137,11 @@ void Scanner::init( )
 
 /* Returns the count of bytes still in the buffer 
  * (shifted to the biginning) */
-void Scanner::execute( char *data, int len )
+void Scanner::execute( const char *data, int len )
 {
-       char *p = data;
-       char *pe = data + len;
-       char *eof = pe;
+       const char *p = data;
+       const char *pe = data + len;
+       const char *eof = pe;
 
        %% write exec;
 
@@ -168,7 +168,7 @@ void Scanner::token( int tok )
        cout << '\n';
 }
 
-void test( char *buf )
+void test( const char *buf )
 {
        int len = strlen( buf );
        std::ios::sync_with_stdio(false);
index 6f25500..0795778 100644 (file)
@@ -8,7 +8,7 @@ using namespace std;
 struct LangEl
 {
        int key;
-       char *name;
+       const char *name;
 };
 
 struct Fsm
index e928179..d5c01ea 100644 (file)
@@ -86,7 +86,7 @@ int ErrAct::finish( )
 
 #define BUFSIZE 1024
 
-void test( char *buf )
+void test( const char *buf )
 {
        ErrAct errAct;
        errAct.init();
index 36a5e78..48f3fb7 100644 (file)
@@ -40,11 +40,11 @@ using namespace std;
 struct Scanner
 {
        int cs, act;
-       char *tokstart, *tokend;
+       const char *tokstart, *tokend;
        bool isCxx;
 
        void token( int tok );
-       void run( char *buf );
+       void run( const char *buf );
 };
 
 
@@ -150,13 +150,13 @@ void Scanner::token( int tok )
        cout << '\n';
 }
 
-void Scanner::run( char *buf )
+void Scanner::run( const char *buf )
 {
        int len = strlen( buf );
        %% write init;
-       char *p = buf;
-       char *pe = buf + len;
-       char *eof = pe;
+       const char *p = buf;
+       const char *pe = buf + len;
+       const char *eof = pe;
        %% write exec;
 
        if ( cs == Scanner_error ) {
index bf9a87e..e7cd37c 100644 (file)
@@ -21,7 +21,7 @@ struct MBox
        // the data, the machine is in the error state and can never accept, 0 if
        // the machine is in a non-accepting state and 1 if the machine is in an
        // accepting state.
-       void execute( char *data, int len );
+       void execute( const char *data, int len );
 
        // Indicate that there is no more data. Returns -1 if the machine finishes
        // in the error state and does not accept, 0 if the machine finishes
index a2bbea9..ea23173 100644 (file)
@@ -99,11 +99,11 @@ void MBox::init( )
        %% write init;
 }
 
-void MBox::execute( char *data, int len )
+void MBox::execute( const char *data, int len )
 {
        MBox *fsm = this;
-       char *p = data;
-       char *pe = data + len;
+       const char *p = data;
+       const char *pe = data + len;
        %%{
                access fsm->;
                write exec;
@@ -121,7 +121,7 @@ int MBox::finish( )
 
 MBox mbox;
 
-void test( char *buf )
+void test( const char *buf )
 {
        int len = strlen( buf );
        mbox.init();
index d84696d..ce98b09 100644 (file)
@@ -121,14 +121,14 @@ using std::endl;
 
 #define BUFSIZE 8192
 
-void test( char *buf )
+void test( const char *buf )
 {
        int cs, len = strlen( buf );
-       char *preserve = 0, *ws = 0;
+       const char *preserve = 0, *ws = 0;
 
        %% write init;
-       char *p = buf;
-       char *pe = p + len;
+       const char *p = buf;
+       const char *pe = p + len;
        %% write exec;
 
        if ( cs == mailbox_error )
index e8089bb..8f923ba 100644 (file)
@@ -129,15 +129,15 @@ using std::endl;
 
 #define BUFSIZE 8192
 
-void test( char *buf )
+void test( const char *buf )
 {
        int cs, len = strlen( buf );
-       char *preserve = 0, *ws = 0;
+       const char *preserve = 0, *ws = 0;
        int hlen = 0;
 
        %% write init;
-       char *p = buf;
-       char *pe = p + len;
+       const char *p = buf;
+       const char *pe = p + len;
        %% write exec;
 
        if ( cs < mailbox_first_final ) {
index b14067e..328cfa9 100644 (file)
@@ -7,6 +7,7 @@
 #include <iostream>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 using namespace std;
 
@@ -69,7 +70,7 @@ int Rep::finish( )
        return 0;
 }
 
-void test( char *buf )
+void test( const char *buf )
 {
        Rep rep;
        int len = strlen( buf );
index 27cd655..1bc683b 100644 (file)
@@ -13,7 +13,7 @@
 
 using namespace std;
 
-void escapeXML( char *data )
+void escapeXML( const char *data )
 {
        while ( *data != 0 ) {
                switch ( *data ) {
@@ -36,9 +36,9 @@ void escapeXML( char c )
        }
 }
 
-void escapeXML( char *data, int len )
+void escapeXML( const char *data, int len )
 {
-       for ( char *end = data + len; data != end; data++  ) {
+       for ( const char *end = data + len; data != end; data++  ) {
                switch ( *data ) {
                        case '<': cout << "&lt;"; break;
                        case '>': cout << "&gt;"; break;
@@ -48,7 +48,7 @@ void escapeXML( char *data, int len )
        }
 }
 
-inline void write( char *data )
+inline void write( const char *data )
 {
        cout << data;
 }
@@ -58,7 +58,7 @@ inline void write( char c )
        cout << c;
 }
 
-inline void write( char *data, int len )
+inline void write( const char *data, int len )
 {
        cout.write( data, len );
 }
@@ -242,12 +242,12 @@ inline void write( char *data, int len )
 
 %% write data nofinal;
 
-void test( char *data )
+void test( const char *data )
 {
        std::ios::sync_with_stdio(false);
 
        int cs, act;
-       char *tokstart, *tokend;
+       const char *tokstart, *tokend;
        int stack[1], top;
 
        bool single_line = false;
@@ -256,9 +256,9 @@ void test( char *data )
        %% write init;
 
        /* Read in a block. */
-       char *p = data;
-       char *pe = data + strlen( data );
-       char *eof = pe;
+       const char *p = data;
+       const char *pe = data + strlen( data );
+       const char *eof = pe;
        %% write exec;
 
        if ( cs == RagelScan_error ) {
index 6200c28..9f91a75 100755 (executable)
@@ -250,7 +250,7 @@ for test_case; do
        [ -z "$allow_minflags" ] && allow_minflags="-n -m -l -e"
 
        case $lang in
-       c|obj-c|c++|d)
+       c|c++|d)
                # Using genflags, get the allowed gen flags from the test case. If the
                # test case doesn't specify assume that all gen flags are allowed.
                allow_genflags=`sed '/@ALLOW_GENFLAGS:/s/^.*: *//p;d' $test_case`
index 8be02e2..41e24bf 100644 (file)
@@ -6,6 +6,7 @@
 #include <iostream>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 using namespace std;
 
@@ -114,7 +115,7 @@ int Concurrent::finish( )
        return 0;
 }
 
-void test( char *buf )
+void test( const char *buf )
 {
        Concurrent concurrent;
        concurrent.init();