[PATCH 4/4] libtests/malloctest/init.c: Fix warning
Joel Sherrill
joel.sherrill at oarcorp.com
Wed Nov 19 22:45:58 UTC 2014
On 11/19/2014 4:32 PM, Chris Johns wrote:
> On 20/11/2014 6:59 am, Joel Sherrill wrote:
>> + #pragma GCC diagnostic push
>> + #pragma GCC diagnostic ignored "-Wnonnull"
> Do we allow the use of #pragma in RTEMS ?
I would say no except for this one particular class.
If a method has the proper prototype with the attribute
"nonnull" on a parameter AND you compiler with -Wnon-null,
then you get a warning for passing a NULL if GCC can detect it.
If a user doesn't compile with this option, then you need a
run-time check and we have them. And we have to test those
NULL checks.
This is TEST code and we are intentionally passing a
hard-coded NULL value in to exercise the run-time check.
We always compile with -Wnon-null so we have to disable
the check for this one specific type of test on methods which
have parameters with this attribute.
Once Trac/Wiki is back up, that should be added to the
Coding Conventions.
FWIW I have never used a pragma in C or C++ before this. Use would
have to be very special and justified than this in test code.
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the devel
mailing list