From 25a3666e47a96aacefc150ac8ed114d0c3f08ab2 Mon Sep 17 00:00:00 2001 From: jsalling Date: Sun, 24 Apr 2016 12:07:51 -0500 Subject: [PATCH 1/3] Add Unity Fixture to the travisCI build, and use Makefile builds Prevent changes in core Unity from silently breaking Fixture --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 74dc382..ca664b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,3 +4,6 @@ rvm: - "2.0.0" script: - cd test && rake ci + - make -s + - cd ../extras/fixture/test && rake ci + - make -s default noStdLibMalloc From 573481729b4f93c7cbb3d6ccf9d1e8b1c607b58c Mon Sep 17 00:00:00 2001 From: jsalling Date: Sun, 24 Apr 2016 12:14:44 -0500 Subject: [PATCH 2/3] Revert commits 720ea42 and a27b03c which broke the Fixture build These were aimed at preventing the internals header from declaring a prototype for 'int UNITY_OUTPUT_CHAR(int);'. The second part fixed an omitted declaration in the tests caused by the first commit. Will replace the default behavior & add an option for this in next commit --- src/unity.c | 5 ----- src/unity_internals.h | 9 +++------ test/tests/testunity.c | 2 -- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/unity.c b/src/unity.c index 8541274..b398b3f 100644 --- a/src/unity.c +++ b/src/unity.c @@ -7,11 +7,6 @@ #include "unity.h" #include -#ifndef UNITY_OUTPUT_CHAR_USE_PUTC -//If defined as something else, make sure we declare it here so it's ready for use -extern int UNITY_OUTPUT_CHAR(int); -#endif - #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); } #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); } /// return prematurely if we are already in failure or ignore state diff --git a/src/unity_internals.h b/src/unity_internals.h index 81058be..6549656 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -291,12 +291,9 @@ typedef UNITY_DOUBLE_TYPE _UD; //Default to using putchar, which is defined in stdio.h #include #define UNITY_OUTPUT_CHAR(a) putchar(a) -// We need to flag the output char function uses putc in -// unity.c the extern function is not declared then. -// Previously the extern was declared in this header but -// when redundant function declaration compiler flag is enabled -// it wont compile. -#define UNITY_OUTPUT_CHAR_USE_PUTC +#else +//If defined as something else, make sure we declare it here so it's ready for use +extern int UNITY_OUTPUT_CHAR(int); #endif #ifndef UNITY_PRINT_EOL diff --git a/test/tests/testunity.c b/test/tests/testunity.c index 77eeb21..9fae64e 100644 --- a/test/tests/testunity.c +++ b/test/tests/testunity.c @@ -8,8 +8,6 @@ #include "unity.h" #include -int putcharSpy(int c); - // Dividing by these constants produces +/- infinity. // The rationale is given in UnityAssertFloatIsInf's body. #ifndef UNITY_EXCLUDE_FLOAT From 593a03462ec6e92edae6ca574848e9122c3e42fc Mon Sep 17 00:00:00 2001 From: jsalling Date: Sun, 24 Apr 2016 12:28:46 -0500 Subject: [PATCH 3/3] Add an option to omit UNITY_OUTPUT_CHAR declaration from the header This solves the warnings from -Wredundant-decls when overriding the OUTPUT function with a function declared in another header. It's better this is the non-default option, since using it requires either a declaration of the new function OR a preprocessor guard on declaring UNITY_OUTPUT_CHAR (as in unity.c here), in every file using the function. See Pull Request #185 for more. --- .travis.yml | 2 +- src/unity.c | 3 +++ src/unity_internals.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ca664b3..d75cbd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,4 @@ script: - cd test && rake ci - make -s - cd ../extras/fixture/test && rake ci - - make -s default noStdLibMalloc + - make -s default noStdlibMalloc diff --git a/src/unity.c b/src/unity.c index b398b3f..d8df1e0 100644 --- a/src/unity.c +++ b/src/unity.c @@ -7,6 +7,9 @@ #include "unity.h" #include +#ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION +int UNITY_OUTPUT_CHAR(int); //If omitted from header, declare it here so it's ready for use +#endif #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); } #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); } /// return prematurely if we are already in failure or ignore state diff --git a/src/unity_internals.h b/src/unity_internals.h index 6549656..560d28f 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -293,7 +293,9 @@ typedef UNITY_DOUBLE_TYPE _UD; #define UNITY_OUTPUT_CHAR(a) putchar(a) #else //If defined as something else, make sure we declare it here so it's ready for use + #ifndef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION extern int UNITY_OUTPUT_CHAR(int); + #endif #endif #ifndef UNITY_PRINT_EOL