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