Remainder of warnings fixed.
authorthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 02:53:06 +0000 (02:53 +0000)
committerthurston <thurston@052ea7fc-9027-0410-9066-f65837a77df0>
Sat, 5 Jan 2008 02:53:06 +0000 (02:53 +0000)
git-svn-id: http://svn.complang.org/ragel/trunk@374 052ea7fc-9027-0410-9066-f65837a77df0

common/common.h
ragel/fsmgraph.h
ragel/main.cpp
ragel/parsedata.cpp
ragel/parsedata.h
ragel/parsetree.cpp
ragel/parsetree.h
ragel/ragel.h

index cb43fbf..8495e74 100644 (file)
@@ -350,10 +350,10 @@ char *fileNameFromStem( char *stemFile, const char *suffix );
 
 struct Export
 {
-       Export( char *name, Key key )
+       Export( const char *name, Key key )
                : name(name), key(key) {}
 
-       char *name;
+       const char *name;
        Key key;
 
        Export *prev, *next;
index 8b0ffd7..c8dac52 100644 (file)
@@ -97,7 +97,7 @@ struct Action
 {
 public:
 
-       Action( const InputLoc &loc, char *name, InlineList *inlineList, int condId )
+       Action( const InputLoc &loc, const char *name, InlineList *inlineList, int condId )
        :
                loc(loc),
                name(name),
@@ -115,11 +115,11 @@ public:
        }
 
        /* Key for action dictionary. */
-       char *getKey() const { return name; }
+       const char *getKey() const { return name; }
 
        /* Data collected during parse. */
        InputLoc loc;
-       char *name;
+       const char *name;
        InlineList *inlineList;
        int actionId;
 
index a5a5d9a..0943eef 100644 (file)
@@ -72,7 +72,7 @@ bool printStatistics = false;
 bool frontendOnly = false;
 bool generateDot = false;
 
-typedef Vector<char*> ArgsVector;
+typedef Vector<const char *> ArgsVector;
 ArgsVector frontendArgs;
 ArgsVector backendArgs;
 
@@ -392,7 +392,8 @@ int frontend( char *inputFileName, char *outputFileName )
 
 char *makeIntermedTemplate( char *baseFileName )
 {
-       char *result = 0, *templ = "ragel-XXXXXX.xml";
+       char *result = 0;
+       const char *templ = "ragel-XXXXXX.xml";
        char *lastSlash = strrchr( baseFileName, '/' );
        if ( lastSlash == 0 ) {
                result = new char[strlen(templ)+1];
@@ -501,7 +502,7 @@ char **makePathChecksUnix( const char *argv0, const char *progName )
 }
 
 
-void forkAndExec( char *progName, char **pathChecks, 
+void forkAndExec( const char *progName, char **pathChecks, 
                ArgsVector &args, char *intermed )
 {
        pid_t pid = fork();
@@ -513,7 +514,9 @@ void forkAndExec( char *progName, char **pathChecks,
        else if ( pid == 0 ) {
                /* child */
                while ( *pathChecks != 0 ) {
-                       execv( *pathChecks, args.data );
+                       /* Execv does not modify argv, it just uses the const form that is
+                        * compatible with the most code. Ours not included. */
+                       execv( *pathChecks, (char *const*) args.data );
                        pathChecks += 1;
                }
                error() << "failed to exec " << progName << endl;
@@ -599,7 +602,7 @@ void spawn( char *progName, char **pathChecks,
 void execFrontend( const char *argv0, char *inputFileName, char *intermed )
 {
        /* The frontend program name. */
-       char *progName = "ragel";
+       const char *progName = "ragel";
 
        frontendArgs.insert( 0, progName );
        frontendArgs.insert( 1, "-f" );
@@ -620,7 +623,7 @@ void execFrontend( const char *argv0, char *inputFileName, char *intermed )
 void execBackend( const char *argv0, char *intermed, char *outputFileName )
 {
        /* Locate the backend program */
-       char *progName = 0;
+       const char *progName = 0;
        if ( generateDot )
                progName = "rlgen-dot";
        else {
index 42a79ce..3fae998 100644 (file)
@@ -471,7 +471,7 @@ ParseData::~ParseData()
 
 /* Make a name id in the current name instantiation scope if it is not
  * already there. */
-NameInst *ParseData::addNameInst( const InputLoc &loc, char *data, bool isLabel )
+NameInst *ParseData::addNameInst( const InputLoc &loc, const char *data, bool isLabel )
 {
        /* Create the name instantitaion object and insert it. */
        NameInst *newNameInst = new NameInst( loc, curNameInst, data, nextNameId++, isLabel );
@@ -556,7 +556,7 @@ void ParseData::unsetObsoleteEntries( FsmAp *graph )
        }
 }
 
-NameSet ParseData::resolvePart( NameInst *refFrom, char *data, bool recLabelsOnly )
+NameSet ParseData::resolvePart( NameInst *refFrom, const char *data, bool recLabelsOnly )
 {
        /* Queue needed for breadth-first search, load it with the start node. */
        NameInstList nameQueue;
@@ -819,7 +819,7 @@ void ParseData::makeNameTree( GraphDictEl *dictEl )
 }
 
 
-void ParseData::createBuiltin( char *name, BuiltinMachine builtin )
+void ParseData::createBuiltin( const char *name, BuiltinMachine builtin )
 {
        Expression *expression = new Expression( builtin );
        Join *join = new Join( expression );
@@ -960,7 +960,7 @@ void ParseData::removeActionDups( FsmAp *graph )
        }
 }
 
-Action *ParseData::newAction( char *name, InlineList *inlineList )
+Action *ParseData::newAction( const char *name, InlineList *inlineList )
 {
        InputLoc loc;
        loc.line = 1;
@@ -1121,7 +1121,7 @@ void ParseData::printNameTree()
        /* Show that the name index is correct. */
        for ( int ni = 0; ni < nextNameId; ni++ ) {
                cerr << ni << ": ";
-               char *name = nameIndex[ni]->name;
+               const char *name = nameIndex[ni]->name;
                cerr << ( name != 0 ? name : "<ANON>" ) << endl;
        }
 }
index 257076b..fc2b9c0 100644 (file)
@@ -62,14 +62,14 @@ struct GraphDictEl
        public AvlTreeEl<GraphDictEl>,
        public DListEl<GraphDictEl>
 {
-       GraphDictEl( char *k ) 
+       GraphDictEl( const char *k ) 
                : key(k), value(0), isInstance(false) { }
-       GraphDictEl( char *k, VarDef *value ) 
+       GraphDictEl( const char *k, VarDef *value ) 
                : key(k), value(value), isInstance(false) { }
 
        const char *getKey() { return key; }
 
-       char *key;
+       const char *key;
        VarDef *value;
        bool isInstance;
 
@@ -77,7 +77,7 @@ struct GraphDictEl
        InputLoc loc;
 };
 
-typedef AvlTree<GraphDictEl, char*, CmpStr> GraphDict;
+typedef AvlTree<GraphDictEl, const char*, CmpStr> GraphDict;
 typedef DList<GraphDictEl> GraphList;
 
 /* Priority name dictionary. */
@@ -85,19 +85,19 @@ typedef AvlMapEl<char*, int> PriorDictEl;
 typedef AvlMap<char*, int, CmpStr> PriorDict;
 
 /* Local error name dictionary. */
-typedef AvlMapEl<char*, int> LocalErrDictEl;
-typedef AvlMap<char*, int, CmpStr> LocalErrDict;
+typedef AvlMapEl<const char*, int> LocalErrDictEl;
+typedef AvlMap<const char*, int, CmpStr> LocalErrDict;
 
 /* Tree of instantiated names. */
-typedef BstMapEl<char*, NameInst*> NameMapEl;
-typedef BstMap<char*, NameInst*, CmpStr> NameMap;
+typedef BstMapEl<const char*, NameInst*> NameMapEl;
+typedef BstMap<const char*, NameInst*, CmpStr> NameMap;
 typedef Vector<NameInst*> NameVect;
 typedef BstSet<NameInst*> NameSet;
 
 /* Node in the tree of instantiated names. */
 struct NameInst
 {
-       NameInst( const InputLoc &loc, NameInst *parent, char *name, int id, bool isLabel ) : 
+       NameInst( const InputLoc &loc, NameInst *parent, const char *name, int id, bool isLabel ) : 
                loc(loc), parent(parent), name(name), id(id), isLabel(isLabel),
                isLongestMatch(false), numRefs(0), numUses(0), start(0), final(0) {}
 
@@ -107,7 +107,7 @@ struct NameInst
         * fully qulified names. */
        NameInst *parent;
 
-       char *name;
+       const char *name;
        int id;
        bool isLabel;
        bool isLongestMatch;
@@ -163,11 +163,11 @@ struct ParseData
 
        /* Initialize a graph dict with the basic fsms. */
        void initGraphDict();
-       void createBuiltin( char *name, BuiltinMachine builtin );
+       void createBuiltin( const char *name, BuiltinMachine builtin );
 
        /* Make a name id in the current name instantiation scope if it is not
         * already there. */
-       NameInst *addNameInst( const InputLoc &loc, char *data, bool isLabel );
+       NameInst *addNameInst( const InputLoc &loc, const char *data, bool isLabel );
        void makeRootNames();
        void makeNameTree( GraphDictEl *gdNode );
        void makeExportsNameTree();
@@ -179,7 +179,7 @@ struct ParseData
        void unsetObsoleteEntries( FsmAp *graph );
 
        /* Resove name references in action code and epsilon transitions. */
-       NameSet resolvePart( NameInst *refFrom, char *data, bool recLabelsOnly );
+       NameSet resolvePart( NameInst *refFrom, const char *data, bool recLabelsOnly );
        void resolveFrom( NameSet &result, NameInst *refFrom, 
                        const NameRef &nameRef, int namePos );
        NameInst *resolveStateRef( const NameRef &nameRef, InputLoc &loc, Action *action );
@@ -329,7 +329,7 @@ struct ParseData
        /* List of all longest match parse tree items. */
        LmList lmList;
 
-       Action *newAction( char *name, InlineList *inlineList );
+       Action *newAction( const char *name, InlineList *inlineList );
 
        Action *initTokStart;
        int initTokStartOrd;
index 7310e16..6725378 100644 (file)
@@ -162,7 +162,7 @@ InputLoc LongestMatchPart::getLoc()
  */
 
 Action *LongestMatch::newAction( ParseData *pd, const InputLoc &loc, 
-               char *name, InlineList *inlineList )
+               const char *name, InlineList *inlineList )
 {
        Action *action = new Action( loc, name, inlineList, pd->nextCondId++ );
        action->actionRefs.append( pd->curNameInst );
index a25525f..f1f4181 100644 (file)
@@ -219,7 +219,7 @@ struct PriorityAug
  */
 struct VarDef
 {
-       VarDef( char *name, JoinOrLm *joinOrLm )
+       VarDef( const char *name, JoinOrLm *joinOrLm )
                : name(name), joinOrLm(joinOrLm), isExport(false) { }
        
        /* Parse tree traversal. */
@@ -227,7 +227,7 @@ struct VarDef
        void makeNameTree( const InputLoc &loc, ParseData *pd );
        void resolveNameRefs( ParseData *pd );
 
-       char *name;
+       const char *name;
        JoinOrLm *joinOrLm;
        bool isExport;
 };
@@ -299,7 +299,7 @@ struct LongestMatch
        void makeNameTree( ParseData *pd );
        void resolveNameRefs( ParseData *pd );
        void runLonestMatch( ParseData *pd, FsmAp *graph );
-       Action *newAction( ParseData *pd, const InputLoc &loc, char *name, 
+       Action *newAction( ParseData *pd, const InputLoc &loc, const char *name, 
                        InlineList *inlineList );
        void makeActions( ParseData *pd );
        void findName( ParseData *pd );
@@ -307,7 +307,7 @@ struct LongestMatch
 
        InputLoc loc;
        LmPartList *longestMatchList;
-       char *name;
+       const char *name;
 
        Action *lmActSelect;
        bool lmSwitchHandlesError;
index d7f652a..53baa0e 100644 (file)
@@ -57,7 +57,7 @@ extern char mainMachine[];
 /* Location in an input file. */
 struct InputLoc
 {
-       char *fileName;
+       const char *fileName;
        int line;
        int col;
 };