diff --git a/lib/cmock_generator.rb b/lib/cmock_generator.rb index 48ec450..949f4e7 100644 --- a/lib/cmock_generator.rb +++ b/lib/cmock_generator.rb @@ -75,6 +75,9 @@ class CMockGenerator file << plugin_includes if (!plugin_includes.empty?) file << "\n" file << "/* Ignore the following warnings, since we are copying code */\n" + file << "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n" + file << "#pragma GCC diagnostic ignored \"-Wpragmas\"\n" + file << "#endif\n" file << "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" file << "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" file << "\n" diff --git a/test/system/systest_generator.rb b/test/system/systest_generator.rb index f04337a..c723d43 100644 --- a/test/system/systest_generator.rb +++ b/test/system/systest_generator.rb @@ -151,6 +151,9 @@ class SystemTestGenerator out.puts("#include \"#{include}\"") end out.puts('') + out.puts("#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)") + out.puts("#pragma GCC diagnostic ignored \"-Wpragmas\"") + out.puts("#endif") out.puts('#pragma GCC diagnostic ignored "-Wunknown-pragmas"') out.puts('#pragma GCC diagnostic ignored "-Wduplicate-decl-specifier"') out.puts('') @@ -167,6 +170,9 @@ class SystemTestGenerator out.puts("#include \"#{include}\"") end out.puts('') + out.puts("#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)") + out.puts("#pragma GCC diagnostic ignored \"-Wpragmas\"") + out.puts("#endif") out.puts('#pragma GCC diagnostic ignored "-Wunknown-pragmas"') out.puts('#pragma GCC diagnostic ignored "-Wduplicate-decl-specifier"') out.puts('') diff --git a/test/system/test_compilation/const.h b/test/system/test_compilation/const.h index 7d100e1..6591622 100644 --- a/test/system/test_compilation/const.h +++ b/test/system/test_compilation/const.h @@ -4,6 +4,9 @@ [Released under MIT License. Please refer to license.txt for details] ========================================== */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) +#pragma GCC diagnostic ignored "-Wpragmas" +#endif #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wduplicate-decl-specifier" diff --git a/test/unit/cmock_generator_main_test.rb b/test/unit/cmock_generator_main_test.rb index a6041f9..35c8ffd 100644 --- a/test/unit/cmock_generator_main_test.rb +++ b/test/unit/cmock_generator_main_test.rb @@ -95,6 +95,9 @@ class CMockGeneratorTest < Test::Unit::TestCase "#include \"PluginRequiredHeader.h\"\n", "\n", "/* Ignore the following warnings, since we are copying code */\n", + "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n", + "#pragma GCC diagnostic ignored \"-Wpragmas\"\n", + "#endif\n", "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n", "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n", "\n", @@ -136,6 +139,9 @@ class CMockGeneratorTest < Test::Unit::TestCase "#include \"PluginRequiredHeader.h\"\n", "\n", "/* Ignore the following warnings, since we are copying code */\n", + "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n", + "#pragma GCC diagnostic ignored \"-Wpragmas\"\n", + "#endif\n", "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n", "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n", "\n", @@ -163,6 +169,9 @@ class CMockGeneratorTest < Test::Unit::TestCase "#include \"#{orig_filename}\"\n", "\n", "/* Ignore the following warnings, since we are copying code */\n", + "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n", + "#pragma GCC diagnostic ignored \"-Wpragmas\"\n", + "#endif\n", "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n", "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n", "\n", @@ -191,6 +200,9 @@ class CMockGeneratorTest < Test::Unit::TestCase "#include \"PluginRequiredHeader.h\"\n", "\n", "/* Ignore the following warnings, since we are copying code */\n", + "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n", + "#pragma GCC diagnostic ignored \"-Wpragmas\"\n", + "#endif\n", "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n", "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n", "\n",