KCL-Planning / VAL

The plan validation system.
BSD 3-Clause "New" or "Revised" License
108 stars 48 forks source link

VAL fails to compile with recent gcc (6.3.0) #18

Closed maltehelmert closed 5 years ago

maltehelmert commented 7 years ago

Shell transcript (Ubuntu 17.04):

$ git clone https://github.com/KCL-Planning/VAL.git
Cloning into 'VAL'...
remote: Counting objects: 378, done.
remote: Total 378 (delta 0), reused 0 (delta 0), pack-reused 378
Receiving objects: 100% (378/378), 23.19 MiB | 3.38 MiB/s, done.
Resolving deltas: 100% (122/122), done.
$ cd VAL
$ make clean
$ make
flex -+ src/Parser/pddl+.lex -o /src/Parser/lex.yy.cc; bison src/pddl+.yacc -o src/pddl+.cpp
flex: can't open -o
/usr/bin/m4:stdin:3275: ERROR: end of file in string
src/pddl+.yacc: warning: 1 shift/reduce conflict [-Wconflicts-sr]
src/pddl+.yacc: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
g++  -g -Wall -Werror -Iinclude -Isrc/Parser -ansi -Wall -c src/pddl+.cpp -o src/pddl+.o
g++  -g -Wall -Werror -Iinclude -Isrc/Parser -ansi -Wall -c src/ptree.cpp -o src/ptree.o
g++  -g -Wall -Werror -Iinclude -Isrc/Parser -ansi -Wall -c src/Action.cpp -o src/Action.o
g++  -g -Wall -Werror -Iinclude -Isrc/Parser -ansi -Wall -c src/Proposition.cpp -o src/Proposition.o
src/Proposition.cpp: In member function ‘std::__cxx11::string VAL::Comparison::getExprnString(const VAL::expression*, const VAL::Environment&) const’:
src/Proposition.cpp:3077:7: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
       if(LaTeX) return "\\exprn{"+ s + "}";
       ^~
src/Proposition.cpp:3078:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   return s;
   ^~~~~~
src/Proposition.cpp: In member function ‘std::__cxx11::string VAL::Comparison::getExprnString(const VAL::expression*, const VAL::Environment&, const VAL::State*) const’:
src/Proposition.cpp:3149:7: error: this ‘if’ clause does not guard... [-Werror=misleading-indentation]
       if(LaTeX) return "\\exprn{"+ toString(fexp)  + "}$[=" + toString(fexp->evaluate(s)) + "]$";
       ^~
src/Proposition.cpp:3150:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   return toString(fexp) + "[=" + toString(fexp->evaluate(s)) + "]";
   ^~~~~~
cc1plus: all warnings being treated as errors
Makefile:49: recipe for target 'src/Proposition.o' failed
make: *** [src/Proposition.o] Error 1

gcc version used:

$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

(Without the make clean step, I get different errors because the repository contains object files that are not compatible with my machine.)

Removing -Werror from the Makefile addresses the issue. I still get some errors and warnings from flex, m4 and gcc when compiling, but the compilation process finishes and VAL seems to work.

Output of the compile without -Werror:

$ make
flex -+ src/Parser/pddl+.lex -o /src/Parser/lex.yy.cc; bison src/pddl+.yacc -o src/pddl+.cpp
flex: can't open -o
/usr/bin/m4:stdin:3275: ERROR: end of file in string
src/pddl+.yacc: warning: 1 shift/reduce conflict [-Wconflicts-sr]
src/pddl+.yacc: warning: 4 reduce/reduce conflicts [-Wconflicts-rr]
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/pddl+.cpp -o src/pddl+.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/ptree.cpp -o src/ptree.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Action.cpp -o src/Action.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Proposition.cpp -o src/Proposition.o
src/Proposition.cpp: In member function ‘std::__cxx11::string VAL::Comparison::getExprnString(const VAL::expression*, const VAL::Environment&) const’:
src/Proposition.cpp:3077:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if(LaTeX) return "\\exprn{"+ s + "}";
       ^~
src/Proposition.cpp:3078:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   return s;
   ^~~~~~
src/Proposition.cpp: In member function ‘std::__cxx11::string VAL::Comparison::getExprnString(const VAL::expression*, const VAL::Environment&, const VAL::State*) const’:
src/Proposition.cpp:3149:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if(LaTeX) return "\\exprn{"+ toString(fexp)  + "}$[=" + toString(fexp->evaluate(s)) + "]$";
       ^~
src/Proposition.cpp:3150:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   return toString(fexp) + "[=" + toString(fexp->evaluate(s)) + "]";
   ^~~~~~
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/FuncExp.cpp -o src/FuncExp.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/typecheck.cpp -o src/typecheck.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/main.cpp -o src/main.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Validator.cpp -o src/Validator.o
src/Validator.cpp: In member function ‘std::pair<const VAL::plan_step*, std::pair<bool, bool> > VAL::PlanRepair::repairPlanOneAction(const VAL::plan*, const VAL::plan_step*)’:
src/Validator.cpp:3216:11: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
        {  if(planRepairValidator->checkGoal(theGoal)) //goalSatisfied = true;
           ^~
src/Validator.cpp:3218:36: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
                actionFixed = true; planRepaired = true; break;
                                    ^~~~~~~~~~~~
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/RepairAdvice.cpp -o src/RepairAdvice.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/LaTeXSupport.cpp -o src/LaTeXSupport.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/State.cpp -o src/State.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Plan.cpp -o src/Plan.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Ownership.cpp -o src/Ownership.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Environment.cpp -o src/Environment.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Polynomial.cpp -o src/Polynomial.o
src/Polynomial.cpp: In member function ‘void VAL::Intervals::writeOffset(double) const’:
src/Polynomial.cpp:143:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
       if(LaTeX) *report << "$";
       ^~
src/Polynomial.cpp:144:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   for(vector< pair<intervalEnd,intervalEnd> >::const_iterator i = intervals.begin(); i != intervals.end();)
   ^~~
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/DebugWriteController.cpp -o src/DebugWriteController.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Utils.cpp -o src/Utils.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/TrajectoryConstraints.cpp -o src/TrajectoryConstraints.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/RobustAnalyse.cpp -o src/RobustAnalyse.o
src/RobustAnalyse.cpp: In function ‘std::__cxx11::string VAL::getPlanStepString(const VAL::plan_step*)’:
src/RobustAnalyse.cpp:691:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if(ps == 0) return "";
     ^~
src/RobustAnalyse.cpp:692:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’
   string act = "("+ps->op_sym->getName();
   ^~~~~~
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/random.cpp -o src/random.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/Events.cpp -o src/Events.o
g++  -g -Wall -Iinclude -Isrc/Parser -ansi -Wall -c src/PrettyPrinter.cpp -o src/PrettyPrinter.o
g++ -g   -o validate src/pddl+.o src/ptree.o src/Action.o src/Proposition.o src/FuncExp.o src/typecheck.o src/main.o src/Validator.o src/RepairAdvice.o src/LaTeXSupport.o src/State.o src/Plan.o src/Ownership.o src/Environment.o src/Polynomial.o src/DebugWriteController.o src/Utils.o src/TrajectoryConstraints.o src/RobustAnalyse.o src/random.o src/Events.o src/PrettyPrinter.o 
DerekLong101 commented 5 years ago

I think this is now fixed. I am closing it unless someone identifies a continuing problem with the latest Master.