How to ignore the compile warning in CPPUtest?

608 views
Skip to first unread message

kevin wang

unread,
Jan 19, 2015, 3:37:36 AM1/19/15
to cppu...@googlegroups.com
There are some build warnings in my project, but i want to ignore them and pass the build. how to do it?

James Grenning

unread,
Jan 19, 2015, 8:28:17 AM1/19/15
to cppu...@googlegroups.com
This will be compiler dependent. For gcc it almost tells you the
compiler options in the [square brackets]

For example this error/warning:
FakeTimeServiceTest.cpp:38:5: fatal error: use of old-style cast
[-Wold-style-cast]
LONGS_EQUAL(FAKE_TIME_INVALID, TimeService_GetMinute());
^ ~~~~~~~~~~~~~~~~~

can be turned off by adding this compiler option: -Wno-old-style-cast


--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C -
pragprog.com/titles/jgade/
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
> --
> You received this message because you are subscribed to the Google
> Groups "cpputest" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cpputest+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

kevin wang

unread,
Jan 19, 2015, 8:27:57 PM1/19/15
to cppu...@googlegroups.com
I use gcc as the compiler, and I want to disable all the warnings, how to do it in Makefile. Remove -Werror option is enough or not? how to remove it?
 

在 2015年1月19日星期一 UTC+8下午9:28:17,James Grenning写道:

kevin wang

unread,
Jan 19, 2015, 8:53:31 PM1/19/15
to cppu...@googlegroups.com
Here are some of the warnings, but it doesn't print which compiler option could be used.
I want ignore all the warnings, is there any option could be use.

src/include/signal.h:62: warning: ignoring #pragma varparams
src/include/signal.h:63: warning: ignoring #pragma varparams
src/include/signal.h:64: warning: ignoring #pragma varparams
src/include/signal.h:65: warning: ignoring #pragma varparams
src/include/signal.h:66: warning: ignoring #pragma varparams
src/include/signal.h:67: warning: ignoring #pragma varparams
src/include/signal.h:68: warning: ignoring #pragma varparams
src/include/signal.h:69: warning: ignoring #pragma varparams
src/include/signal.h:70: warning: ignoring #pragma varparams
src/include/signal.h:71: warning: ignoring #pragma varparams
src/include/signal.h:72: warning: ignoring #pragma varparams
src/include/signal.h:73: warning: ignoring #pragma varparams
src/include/signal.h:74: warning: ignoring #pragma varparams
src/include/signal.h:75: warning: ignoring #pragma varparams
src/include/signal.h:76: warning: ignoring #pragma varparams
src/include/signal.h:77: warning: ignoring #pragma varparams
src/include/signal.h:78: warning: ignoring #pragma varparams
src/include/signal.h:79: warning: ignoring #pragma varparams
src/include/signal.h:80: warning: ignoring #pragma varparams
src/include/signal.h:81: warning: ignoring #pragma varparams
src/include/signal.h:82: warning: ignoring #pragma varparams
src/include/signal.h:83: warning: ignoring #pragma varparams

A. Robert S.

unread,
Jan 23, 2015, 7:09:02 AM1/23/15
to cppu...@googlegroups.com
I think it is -Wno-unknown-pragmas

Heath Raftery

unread,
Jan 24, 2015, 4:08:38 PM1/24/15
to cppu...@googlegroups.com
Maybe I’m missing something, but don’t you just want to add -w as the last option? That’s the universal gcc flag to disable all warnings. But I’m just answering a gcc question that could be answered by the simplest of Google searches. Is there a cpputest context to this?

Heath

James Grenning

unread,
Jan 24, 2015, 4:23:51 PM1/24/15
to cppu...@googlegroups.com

I think the CppUTest context is that Kevin is learning CppUTest, gcc, linking, makefiles... There are a lot of tools to know to be effective. I find that when you are learning a new network of ideas, it can be hard to even compose a search. It happens to me all the time in Ruby.

Kevin, we'll teach you to fish here. You've got to bait the hook and try to get the easy ones.

James


On 24 Jan 2015, at 15:08, Heath Raftery wrote:

Maybe I’m missing something, but don’t you just want to add -w as the last option? That’s the universal gcc flag to disable all warnings. But I’m just answering a gcc question that could be answered by the simplest of Google searches. Is there a cpputest context to this?

Heath

On 20 Jan 2015, at 12:27 pm, kevin wang wan...@gmail.com wrote:

I use gcc as the compiler, and I want to disable all the warnings, how to do it in Makefile. Remove -Werror option is enough or not? how to remove it?

在 2015年1月19日星期一 UTC+8下午9:28:17,James Grenning写道:
This will be compiler dependent. For gcc it almost tells you the
compiler options in the [square brackets]

For example this error/warning:
FakeTimeServiceTest.cpp:38:5: fatal error: use of old-style cast
[-Wold-style-cast]
LONGS_EQUAL(FAKE_TIME_INVALID, TimeService_GetMinute());
^ ~~~~~~~~~~~~~~~~~

can be turned off by adding this compiler option: -Wno-old-style-cast

wingman<br>
software


On 19 Jan 2015, at 2:37, kevin wang wrote:

There are some build warnings in my project, but i want to ignore them
and
pass the build. how to do it?

--
You received this message because you are subscribed to the Google
Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "cpputest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cpputest+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kevin wang

unread,
Jan 27, 2015, 9:54:56 PM1/27/15
to cppu...@googlegroups.com
Thanks for you reply.
I found the cpputest project already add some flags by default. e.g. the following command, i havn't add the -W... flag in makefile, but it appear in the command, how can I remove them, especially the  -Werror.
 
# cc -g -Wstrict-prototypes  -DCPPUTEST_COMPILATION -Wall -Wextra -Werror -Wshadow -Wswitch-default -Wswitch-enum -Wconversion -pedantic-errors ...
 

在 2015年1月25日星期日 UTC+8上午5:23:51,James Grenning写道:

A. Robert S.

unread,
Feb 2, 2015, 6:58:08 AM2/2/15
to cppu...@googlegroups.com
Hi Kevin,
 
I'm not sure whether I'm barking up the wrong tree here. It looks to me like you might be mixing CppUTest code (you shouldn't need to manipulate any of the compiler switches, and there should be no warnings anyway) with building your own project's code, using the same Makefile or some such thing (possibly).
 
I would advise to keep these separate. Leave CppUTest be the way it is and just install the libraries. Also, the automake / cmake used by CppUTest would be quite complex, far more than you need to know right now.
 
Then, use whatever means you like (personally, I use the codeblocks IDE a lot, and Eclipse when I have to, and occasionally simple Makefiles). If you'd like to compile with a makefile, start with a very simple one. You can then call GCC with just the switches that you want and that are suitable for your situation. You just need to make sure the cpputest headers are in your include path, and the libraries are added during the link step. It's worth learning the basics about makefiles. It's your choice.
 
Regards,
Robert
Reply all
Reply to author
Forward
0 new messages