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: odd behavior


Ah-ha! You're right. Now I see that this warning is issued by
preprocessor, not by compiler. Now that I think about it, it seems
logical. Preprocessor has to tokenize input to perform substitutions
and such, so even if code isn't meant for compiler, it must follow
some rules - ifdefined parts of code are not comments. Is that right?

On Fri, Aug 29, 2014 at 11:11 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 29 August 2014 06:37, JÄdrzej Dudkiewicz wrote:
>> I've seen it few times, but was always my fault and section was in
>> fact compiled. Try preprocessing your input file using -E option and
>> check if it really isn't used.
>
> No, it definitely happens in code that isn't compiled, try it:
>
> #if 0
> const char* s = ";
> #endif
> int main() { }
>
> x.c:2:17: warning: missing terminating " character [enabled by default]
>  const char* s = ";
>                  ^



-- 
JÄdrzej Dudkiewicz

I really hate this damn machine, I wish that they would sell it.
It never does just what I want, but only what I tell it.


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