This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: _Static_warning?


Hi, I believe that won't nail it.
#warning is managed by the preprocessor, not the compiler, so it
shouldn't understand anything about the underlaying c code condition
that should trigger it or not.


On 16 May 2015 at 12:31, Prathamesh Kulkarni
<prathamesh.kulkarni@linaro.org> wrote:
> On 16 May 2015 at 20:28, Eduardo Piombino <drakorg@gmail.com> wrote:
>> Hi,
>>
>> Is there any way to get gcc to generate a warning upon some
>> compile-time condition?
> Try using #warning
> (https://gcc.gnu.org/onlinedocs/gcc-4.5.0/cpp/Diagnostics.html)
>
> Regards,
> Prathamesh
>> I'd be aiming at something like _Static_assert, but raising a warning
>> instead of an error.
>>
>> Nowadays, to achieve something similar, I have to run 2 builds, one
>> with the assert enabled just to get notified of such conditions, and
>> then a another one, without the asserts, to actually compile them.
>>
>> Thank you,
>> Eduardo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]