public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc 4.6 embeded cpp 'feature'
@ 2013-09-06 11:01 phi gcc
  2013-09-06 12:41 ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: phi gcc @ 2013-09-06 11:01 UTC (permalink / raw)
  To: gcc-help

Hi Gurus,

I got this with my xbuild arm32 gcc

CU82$ cat c.c
#define __extension__
#include <unistd.h>
int foo(){char b[4]; b[0]=0; read(0,b,4); return(b[0]);}


CU82$ arm-linux-gnueabi-gcc -E c.c |
           arm-linux-gnueabi-gcc -c -o c.o -O -xc -

CU82$

Meaning it all compile fine with no warnings or errors.

CU82$ arm-linux-gnueabi-gcc -c c.c -O
c.c: In function 'foo':
c.c:3:34: warning: ignoring return value of 'read', declared with attribute warn
_unused_result [-Wunused-result]

Meaning the embeded cpp missed the expansion of __extension__

Is this expected?

We heavily depend on cpp behave the same explicit or embeded


Cheers,
Phi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 4.6 embeded cpp 'feature'
  2013-09-06 11:01 gcc 4.6 embeded cpp 'feature' phi gcc
@ 2013-09-06 12:41 ` Florian Weimer
  2013-09-06 13:11   ` phi gcc
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2013-09-06 12:41 UTC (permalink / raw)
  To: phi gcc; +Cc: gcc-help

On 09/06/2013 01:01 PM, phi gcc wrote:

> #define __extension__

I don't think you can rely on that things work this way because __ __ 
identifiers are reserved.

> Meaning the embeded cpp missed the expansion of __extension__

Have you looked at the header files if they actually use __extension__? 
  (I suspect your embedded libc is different from your host libc.)

-- 
Florian Weimer / Red Hat Product Security Team

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 4.6 embeded cpp 'feature'
  2013-09-06 12:41 ` Florian Weimer
@ 2013-09-06 13:11   ` phi gcc
  2013-09-06 13:16     ` Florian Weimer
  0 siblings, 1 reply; 5+ messages in thread
From: phi gcc @ 2013-09-06 13:11 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

On Fri, Sep 6, 2013 at 2:41 PM, Florian Weimer <fweimer@redhat.com> wrote:
> Have you looked at the header files if they actually use __extension__?  (I
> suspect your embedded libc is different from your host libc.)

from /usr/arm-linux-gnueabi/include/bits/types.h you get
__extension__ typedef signed long long int __int64_t;

At cpp level there are very few reserved identifiers, allowing namespace.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 4.6 embeded cpp 'feature'
  2013-09-06 13:11   ` phi gcc
@ 2013-09-06 13:16     ` Florian Weimer
  2013-09-06 13:51       ` phi gcc
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Weimer @ 2013-09-06 13:16 UTC (permalink / raw)
  To: phi gcc; +Cc: gcc-help

On 09/06/2013 03:11 PM, phi gcc wrote:
> On Fri, Sep 6, 2013 at 2:41 PM, Florian Weimer <fweimer@redhat.com> wrote:
>> Have you looked at the header files if they actually use __extension__?  (I
>> suspect your embedded libc is different from your host libc.)
>
> from /usr/arm-linux-gnueabi/include/bits/types.h you get
> __extension__ typedef signed long long int __int64_t;

Yes, but how is __extension__ used in the declaration of the read function?

> At cpp level there are very few reserved identifiers, allowing namespace.

I doubt that this is a correct reading of the standard.

-- 
Florian Weimer / Red Hat Product Security Team

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gcc 4.6 embeded cpp 'feature'
  2013-09-06 13:16     ` Florian Weimer
@ 2013-09-06 13:51       ` phi gcc
  0 siblings, 0 replies; 5+ messages in thread
From: phi gcc @ 2013-09-06 13:51 UTC (permalink / raw)
  To: Florian Weimer; +Cc: gcc-help

On Fri, Sep 6, 2013 at 3:16 PM, Florian Weimer <fweimer@redhat.com> wrote:

>
> I doubt that this is a correct reading of the standard.
>

Ha yes, just downloaded it, you right

— All identifiers that begin with an underscore and either an
uppercase letter or another
  underscore are always reserved for any use.

Well will have to remove this useless warning with command lines option :)

Cheers,
Phi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-06 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 11:01 gcc 4.6 embeded cpp 'feature' phi gcc
2013-09-06 12:41 ` Florian Weimer
2013-09-06 13:11   ` phi gcc
2013-09-06 13:16     ` Florian Weimer
2013-09-06 13:51       ` phi gcc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).