Merge pull request #42 from gruzdev/pragmas

Add ifdef guards around GCC diagnostic pragmas (Thanks Mikhail! sorry it took me so long to get to this!)
This commit is contained in:
Mark VanderVoord
2014-12-16 14:50:13 -05:00
4 changed files with 24 additions and 8 deletions
+3 -1
View File
@@ -75,11 +75,13 @@ 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 << "#if defined(__GNUC__) && !defined(__ICC)\n"
file << "#if !defined(__clang__)\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 << "#endif\n"
file << "\n"
end
+6 -2
View File
@@ -151,11 +151,13 @@ class SystemTestGenerator
out.puts("#include \"#{include}\"")
end
out.puts('')
out.puts("#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)")
out.puts("#if defined(__GNUC__) && !defined(__ICC)")
out.puts("#if !defined(__clang__)")
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("#endif")
out.puts('')
yield(out)
out.puts('')
@@ -170,11 +172,13 @@ class SystemTestGenerator
out.puts("#include \"#{include}\"")
end
out.puts('')
out.puts("#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)")
out.puts("#if defined(__GNUC__) && !defined(__ICC)")
out.puts("#if !defined(__clang__)")
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("#endif")
out.puts('')
yield(out)
out.puts('')
+3 -1
View File
@@ -4,11 +4,13 @@
[Released under MIT License. Please refer to license.txt for details]
========================================== */
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#if defined(__GNUC__) && !defined(__ICC)
#if !defined(__clang__)
#pragma GCC diagnostic ignored "-Wpragmas"
#endif
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
#pragma GCC diagnostic ignored "-Wduplicate-decl-specifier"
#endif
struct _DUMMY_T { unsigned int a; float b; };
+12 -4
View File
@@ -89,11 +89,13 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
"#include \"PluginRequiredHeader.h\"\n",
"\n",
"/* Ignore the following warnings, since we are copying code */\n",
"#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n",
"#if defined(__GNUC__) && !defined(__ICC)\n",
"#if !defined(__clang__)\n",
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
"#endif\n",
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
"#endif\n",
"\n",
]
@@ -134,11 +136,13 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
"#include \"PluginRequiredHeader.h\"\n",
"\n",
"/* Ignore the following warnings, since we are copying code */\n",
"#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n",
"#if defined(__GNUC__) && !defined(__ICC)\n",
"#if !defined(__clang__)\n",
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
"#endif\n",
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
"#endif\n",
"\n",
]
@@ -165,11 +169,13 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
"#include \"#{orig_filename}\"\n",
"\n",
"/* Ignore the following warnings, since we are copying code */\n",
"#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n",
"#if defined(__GNUC__) && !defined(__ICC)\n",
"#if !defined(__clang__)\n",
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
"#endif\n",
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
"#endif\n",
"\n",
]
@@ -197,11 +203,13 @@ describe CMockGenerator, "Verify CMockGenerator Module" do
"#include \"PluginRequiredHeader.h\"\n",
"\n",
"/* Ignore the following warnings, since we are copying code */\n",
"#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n",
"#if defined(__GNUC__) && !defined(__ICC)\n",
"#if !defined(__clang__)\n",
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n",
"#endif\n",
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n",
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n",
"#endif\n",
"\n",
]