linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* standard OS defines
@ 2007-08-22 18:35 Bryan Christ
  2007-08-22 19:24 ` Stephen Kratzer
  0 siblings, 1 reply; 6+ messages in thread
From: Bryan Christ @ 2007-08-22 18:35 UTC (permalink / raw)
  To: linux-c-programming

does anyone know where i can find a list of standardized OS defines? 
i've come across the list below, but i haven't found an authoritative 
resource convince me these are standard/correct.  even if they are i'm 
sure what i've found is a just a subset of a larger list--but i don't 
know where to look.

__CYGWIN__
__NetBSD__
__OpenBSD__
__linux__
__sun__

also, is there a tool that like getconf that i can use to pipe these 
defines into gcc at compile time?

thanks in advance,
bryan

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

* Re: standard OS defines
  2007-08-22 18:35 standard OS defines Bryan Christ
@ 2007-08-22 19:24 ` Stephen Kratzer
  2007-08-22 19:28   ` Bryan Christ
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Kratzer @ 2007-08-22 19:24 UTC (permalink / raw)
  To: Bryan Christ; +Cc: linux-c-programming

On Wednesday 22 August 2007 14:35:21 Bryan Christ wrote:
> does anyone know where i can find a list of standardized OS defines?
> i've come across the list below, but i haven't found an authoritative
> resource convince me these are standard/correct.  even if they are i'm
> sure what i've found is a just a subset of a larger list--but i don't
> know where to look.
>
> __CYGWIN__
> __NetBSD__
> __OpenBSD__
> __linux__
> __sun__

Take a look at:
info cpp "System-specific Predefined Macros"

A good list is here:
http://predef.sourceforge.net/preos.html

> also, is there a tool that like getconf that i can use to pipe these
> defines into gcc at compile time?

You can define macros on the command line by passing the -D flag to gcc.

> thanks in advance,
> bryan
> -

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

* Re: standard OS defines
  2007-08-22 19:24 ` Stephen Kratzer
@ 2007-08-22 19:28   ` Bryan Christ
  2007-08-22 19:47     ` Stephen Kratzer
  0 siblings, 1 reply; 6+ messages in thread
From: Bryan Christ @ 2007-08-22 19:28 UTC (permalink / raw)
  To: kratzers; +Cc: linux-c-programming

Thanks!  This list is exactly what I was looking for.  Too bad there's 
not a tool for piping to gcc--I was trying to avoid -D.

Bryan

Stephen Kratzer wrote:
> On Wednesday 22 August 2007 14:35:21 Bryan Christ wrote:
>> does anyone know where i can find a list of standardized OS defines?
>> i've come across the list below, but i haven't found an authoritative
>> resource convince me these are standard/correct.  even if they are i'm
>> sure what i've found is a just a subset of a larger list--but i don't
>> know where to look.
>>
>> __CYGWIN__
>> __NetBSD__
>> __OpenBSD__
>> __linux__
>> __sun__
> 
> Take a look at:
> info cpp "System-specific Predefined Macros"
> 
> A good list is here:
> http://predef.sourceforge.net/preos.html
> 
>> also, is there a tool that like getconf that i can use to pipe these
>> defines into gcc at compile time?
> 
> You can define macros on the command line by passing the -D flag to gcc.
> 
>> thanks in advance,
>> bryan
>> -

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

* Re: standard OS defines
  2007-08-22 19:28   ` Bryan Christ
@ 2007-08-22 19:47     ` Stephen Kratzer
  2007-08-22 19:48       ` Bryan Christ
  2007-08-22 20:01       ` Stephen Kratzer
  0 siblings, 2 replies; 6+ messages in thread
From: Stephen Kratzer @ 2007-08-22 19:47 UTC (permalink / raw)
  To: Bryan Christ; +Cc: linux-c-programming

On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
> Thanks!  This list is exactly what I was looking for.  Too bad there's
> not a tool for piping to gcc--I was trying to avoid -D.
>
> Bryan

This is about as ugly as it gets, but here it is anyway:

echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat - 
infile.c | gcc -x c -o outfile.c -
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: standard OS defines
  2007-08-22 19:47     ` Stephen Kratzer
@ 2007-08-22 19:48       ` Bryan Christ
  2007-08-22 20:01       ` Stephen Kratzer
  1 sibling, 0 replies; 6+ messages in thread
From: Bryan Christ @ 2007-08-22 19:48 UTC (permalink / raw)
  To: kratzers; +Cc: linux-c-programming

ugly or not--thanks again!

Stephen Kratzer wrote:
> On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
>> Thanks!  This list is exactly what I was looking for.  Too bad there's
>> not a tool for piping to gcc--I was trying to avoid -D.
>>
>> Bryan
> 
> This is about as ugly as it gets, but here it is anyway:
> 
> echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat - 
> infile.c | gcc -x c -o outfile.c -

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

* Re: standard OS defines
  2007-08-22 19:47     ` Stephen Kratzer
  2007-08-22 19:48       ` Bryan Christ
@ 2007-08-22 20:01       ` Stephen Kratzer
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Kratzer @ 2007-08-22 20:01 UTC (permalink / raw)
  To: Bryan Christ; +Cc: linux-c-programming

On Wednesday 22 August 2007 15:47:25 Stephen Kratzer wrote:
> On Wednesday 22 August 2007 15:28:17 Bryan Christ wrote:
> > Thanks!  This list is exactly what I was looking for.  Too bad there's
> > not a tool for piping to gcc--I was trying to avoid -D.
> >
> > Bryan
>
> This is about as ugly as it gets, but here it is anyway:
>
> echo -e "#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif" | cat -
> infile.c | gcc -x c -o outfile.c -
> -
> To unsubscribe from this list: send the line "unsubscribe
> linux-c-programming" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

The outfile shouldn't have a .c extension since it's a binary. My bad. The 
following is slightly cleaner, but not much:

sed '1 i\#ifndef __SOMETHING__\n#define __SOMETHING__\n#endif\n' infile.c | 
gcc -x c -o outfile -
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2007-08-22 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-22 18:35 standard OS defines Bryan Christ
2007-08-22 19:24 ` Stephen Kratzer
2007-08-22 19:28   ` Bryan Christ
2007-08-22 19:47     ` Stephen Kratzer
2007-08-22 19:48       ` Bryan Christ
2007-08-22 20:01       ` Stephen Kratzer

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 NNTP newsgroup(s).