FAQ Search Today's Posts Mark Forums Read

» Linux Archive
Home
New Posts
Search
FAQ


Go Back   Linux Archive > Redhat > Fedora User

 
 
LinkBack Thread Tools
 
Old 08-06-2008, 03:49 AM
Skunk Worx
 
Default gcc 4.3 warnings

$ gcc foo.c
foo.c:1:16: warning: missing terminating " character

$ cat foo.c
#define DQUOTE "
main() {}

A few people at work have mentioned it seems unusual for a preprocessor
to complain about simple macros this way.


What do others think of this?

TIA,
John

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-06-2008, 10:11 AM
Chris Jones
 
Default gcc 4.3 warnings

Skunk Worx wrote:
> $ gcc foo.c
> foo.c:1:16: warning: missing terminating " character
>
> $ cat foo.c
> #define DQUOTE "
> main() {}
>
> A few people at work have mentioned it seems unusual for a preprocessor
> to complain about simple macros this way.
>
> What do others think of this?

I get the same with gcc 4.2.3

Can't think why you would want to do

#define DQUOTE "

? it looks damn strange to me, I'm not surprised the preprocessor gives
a warning. Suggest you take this to a gcc mailing list, as it has
nothing to do with ubuntu.

cheers Chris

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-06-2008, 10:43 AM
Chris Jones
 
Default gcc 4.3 warnings

? it looks damn strange to me, I'm not surprised the preprocessor gives
a warning. Suggest you take this to a gcc mailing list, as it has
nothing to do with ubuntu.


Umm, or Fedora ...

Chris

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-06-2008, 12:55 PM
Matthew Saltzman
 
Default gcc 4.3 warnings

On Tue, 2008-08-05 at 19:49 -0700, Skunk Worx wrote:
> $ gcc foo.c
> foo.c:1:16: warning: missing terminating " character
>
> $ cat foo.c
> #define DQUOTE "
> main() {}
>
> A few people at work have mentioned it seems unusual for a preprocessor
> to complain about simple macros this way.
>
> What do others think of this?

A macro definition has to consist of a sequence of tokens. A string
constant (sequence of characters enclosed in double quotes) is a token,
but the double quote by itself is not.

If you are trying to construct strings containing macro defs, look at
the stringize operator (#) and token merge operator (##)in the
preprocessor documentation.

>
> TIA,
> John
>
>
--
Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-07-2008, 06:34 AM
Skunk Worx
 
Default gcc 4.3 warnings

Matthew Saltzman wrote:

On Tue, 2008-08-05 at 19:49 -0700, Skunk Worx wrote:

$ gcc foo.c
foo.c:1:16: warning: missing terminating " character

$ cat foo.c
#define DQUOTE "
main() {}

A few people at work have mentioned it seems unusual for a preprocessor
to complain about simple macros this way.


What do others think of this?


A macro definition has to consist of a sequence of tokens. A string
constant (sequence of characters enclosed in double quotes) is a token,
but the double quote by itself is not.

If you are trying to construct strings containing macro defs, look at
the stringize operator (#) and token merge operator (##)in the
preprocessor documentation.



Exactly. This code was written circa 1991 and the warnings came with the
change to Fedora 9.


The preprocessor is being used to generate html code documentation in
the build, including named anchors (#).


A further review of K&R, and other sources on the web, show the use of
the preprocessor for this kind of task is not recommended.


Thanks,
John

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-07-2008, 09:47 AM
Matthew Saltzman
 
Default gcc 4.3 warnings

On Wed, 2008-08-06 at 22:34 -0700, Skunk Worx wrote:
> Matthew Saltzman wrote:
> > On Tue, 2008-08-05 at 19:49 -0700, Skunk Worx wrote:
> >> $ gcc foo.c
> >> foo.c:1:16: warning: missing terminating " character
> >>
> >> $ cat foo.c
> >> #define DQUOTE "
> >> main() {}
> >>
> >> A few people at work have mentioned it seems unusual for a preprocessor
> >> to complain about simple macros this way.
> >>
> >> What do others think of this?
> >
> > A macro definition has to consist of a sequence of tokens. A string
> > constant (sequence of characters enclosed in double quotes) is a token,
> > but the double quote by itself is not.
> >
> > If you are trying to construct strings containing macro defs, look at
> > the stringize operator (#) and token merge operator (##)in the
> > preprocessor documentation.
> >
>
> Exactly. This code was written circa 1991 and the warnings came with the
> change to Fedora 9.
>
> The preprocessor is being used to generate html code documentation in
> the build, including named anchors (#).
>
> A further review of K&R, and other sources on the web, show the use of
> the preprocessor for this kind of task is not recommended.

I imagine it would be some effort to integrate in legacy code, but if I
understand what you're trying to do, it sounds like Doxygen might do
what you want. There are other, similar systems out there as well.
They generally use formatted comments and a separate processor to
generate documentation in various formats.

>
> Thanks,
> John
>
>
--
Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 
Old 08-07-2008, 03:54 PM
Skunk Worx
 
Default gcc 4.3 warnings

Matthew Saltzman wrote:

On Wed, 2008-08-06 at 22:34 -0700, Skunk Worx wrote:

Matthew Saltzman wrote:

On Tue, 2008-08-05 at 19:49 -0700, Skunk Worx wrote:

$ gcc foo.c
foo.c:1:16: warning: missing terminating " character

$ cat foo.c
#define DQUOTE "
main() {}

A few people at work have mentioned it seems unusual for a preprocessor
to complain about simple macros this way.


What do others think of this?

A macro definition has to consist of a sequence of tokens. A string
constant (sequence of characters enclosed in double quotes) is a token,
but the double quote by itself is not.

If you are trying to construct strings containing macro defs, look at
the stringize operator (#) and token merge operator (##)in the
preprocessor documentation.

Exactly. This code was written circa 1991 and the warnings came with the
change to Fedora 9.


The preprocessor is being used to generate html code documentation in
the build, including named anchors (#).


A further review of K&R, and other sources on the web, show the use of
the preprocessor for this kind of task is not recommended.


I imagine it would be some effort to integrate in legacy code, but if I
understand what you're trying to do, it sounds like Doxygen might do
what you want. There are other, similar systems out there as well.
They generally use formatted comments and a separate processor to
generate documentation in various formats.



We use doxygen in the newer parts of the tree. A few minor adjustments
eliminated 3/4ths of the warnings so we're moving on for now.


Regards,
John

--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
 

Thread Tools




All times are GMT. The time now is 02:06 PM.

VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org