[PATCH 4/4] libtests/malloctest/init.c: Fix warning

Joel Sherrill joel.sherrill at oarcorp.com
Thu Nov 20 02:35:44 UTC 2014



On November 19, 2014 8:34:23 PM CST, Gedare Bloom <gedare at rtems.org> wrote:
>I'd prefer to see it hidden behind a macro, like other
>compiler-specific stuff (e.g. attributes). It could go in tmacros
>also, since it should be restricted to testing.

Can you write this as a macro?

>I will oppose any #pragma within cpukit or c subdirectories.

Me too.

>
>-Gedare
>
>On Wed, Nov 19, 2014 at 5:45 PM, Joel Sherrill
><joel.sherrill at oarcorp.com> wrote:
>>
>> 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
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel




More information about the devel mailing list