no-warn-unused-vars.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --- a/cdcodegen.cpp
  2. +++ b/cdcodegen.cpp
  3. @@ -654,20 +654,20 @@ string FsmCodeGen::WIDE_ALPH_TYPE()
  4. void FsmCodeGen::STATE_IDS()
  5. {
  6. if ( redFsm->startState != 0 )
  7. - STATIC_VAR( "int", START() ) << " = " << START_STATE_ID() << ";\n";
  8. + STATIC_VAR( "int", START() ) << " = " << START_STATE_ID() << "};\n";
  9. if ( !noFinal )
  10. - STATIC_VAR( "int" , FIRST_FINAL() ) << " = " << FIRST_FINAL_STATE() << ";\n";
  11. + STATIC_VAR( "int" , FIRST_FINAL() ) << " = " << FIRST_FINAL_STATE() << "};\n";
  12. if ( !noError )
  13. - STATIC_VAR( "int", ERROR() ) << " = " << ERROR_STATE() << ";\n";
  14. + STATIC_VAR( "int", ERROR() ) << " = " << ERROR_STATE() << "};\n";
  15. out << "\n";
  16. if ( !noEntry && entryPointNames.length() > 0 ) {
  17. for ( EntryNameVect::Iter en = entryPointNames; en.lte(); en++ ) {
  18. STATIC_VAR( "int", DATA_PREFIX() + "en_" + *en ) <<
  19. - " = " << entryPointIds[en.pos()] << ";\n";
  20. + " = " << entryPointIds[en.pos()] << "};\n";
  21. }
  22. out << "\n";
  23. }
  24. @@ -704,7 +704,11 @@ string CCodeGen::PTR_CONST_END()
  25. std::ostream &CCodeGen::OPEN_ARRAY( string type, string name )
  26. {
  27. + out << "#if defined(__GNUC__)\n";
  28. + out << "static __attribute__((used)) const " << type << " " << name << "[] = {\n";
  29. + out << "#else\n";
  30. out << "static const " << type << " " << name << "[] = {\n";
  31. + out << "#endif\n";
  32. return out;
  33. }
  34. @@ -715,7 +719,7 @@ std::ostream &CCodeGen::CLOSE_ARRAY()
  35. std::ostream &CCodeGen::STATIC_VAR( string type, string name )
  36. {
  37. - out << "static const " << type << " " << name;
  38. + out << "enum {" << name;
  39. return out;
  40. }