From f597ba92a94098f597837bb4c8fa12d41964c307 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Wed, 9 Jul 2014 09:05:48 -0400 Subject: [PATCH] revert cmock_line change because it was breaking on some systems handle filenames with dashes and whatnot when creating header definition name --- lib/cmock_generator.rb | 6 +++--- targets/clang_strict.yml | 2 +- test/unit/cmock_generator_main_test.rb | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cmock_generator.rb b/lib/cmock_generator.rb index a676924f..cc57b9ec 100644 --- a/lib/cmock_generator.rb +++ b/lib/cmock_generator.rb @@ -63,7 +63,7 @@ def create_mock_source_file(parsed_stuff) end def create_mock_header_header(file, filename) - define_name = @clean_mock_name.gsub(/\.h/, "_h").upcase + define_name = @clean_mock_name.gsub(/[-\/\\\.\,\s]+/,'_').upcase orig_filename = filename[@config.mock_prefix.size..-1] file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" file << "#ifndef _#{define_name}_H\n" @@ -136,7 +136,7 @@ def create_extern_declarations(file) def create_mock_verify_function(file, functions) file << "void #{@clean_mock_name}_Verify(void)\n{\n" verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join - file << " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" unless verifications.empty? file << verifications file << "}\n\n" end @@ -170,7 +170,7 @@ def create_mock_implementation(file, function) # Create mock function file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n" file << "{\n" - file << " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n" + file << " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n" file << " CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{function[:name]}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.#{function[:name]}_CallInstance);\n" file << " Mock.#{function[:name]}_CallInstance = CMock_Guts_MemNext(Mock.#{function[:name]}_CallInstance);\n" file << @plugins.run(:mock_implementation_precheck, function) diff --git a/targets/clang_strict.yml b/targets/clang_strict.yml index a2054d2b..18ca6e30 100644 --- a/targets/clang_strict.yml +++ b/targets/clang_strict.yml @@ -25,7 +25,7 @@ compiler: - '-Wpointer-arith' - '-Wredundant-decls' - '-Wswitch-default' - - '-Wstrict-aliasing' + - '-Wstrict-aliasing=2' - '-Wstrict-overflow=5' - '-Wuninitialized' - '-Wunused' diff --git a/test/unit/cmock_generator_main_test.rb b/test/unit/cmock_generator_main_test.rb index 2cc7625f..94a7546b 100644 --- a/test/unit/cmock_generator_main_test.rb +++ b/test/unit/cmock_generator_main_test.rb @@ -323,7 +323,7 @@ def teardown ] output = [] expected = [ "void MockPoutPoutFish_Verify(void)\n{\n", - " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", " Uno_First" + " Dos_First" + " Uno_Second" + @@ -398,7 +398,7 @@ def teardown output = [] expected = [ "static int SupaFunction(uint32 sandwiches, const char* named)\n", "{\n", - " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", " uno", @@ -430,7 +430,7 @@ def teardown output = [] expected = [ "int __stdcall SupaFunction(uint32 sandwiches, corn ...)\n", "{\n", - " UNITY_LINE_TYPE cmock_line;\n cmock_line = TEST_LINE_NUM;\n", + " UNITY_LINE_TYPE cmock_line = TEST_LINE_NUM;\n", " CMOCK_SupaFunction_CALL_INSTANCE* cmock_call_instance = (CMOCK_SupaFunction_CALL_INSTANCE*)CMock_Guts_GetAddressFor(Mock.SupaFunction_CallInstance);\n", " Mock.SupaFunction_CallInstance = CMock_Guts_MemNext(Mock.SupaFunction_CallInstance);\n", " uno",