This is the mail archive of the gcc-patches@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: [PATCH/RFA] Add -CC option to cpplib to save comments in macros


On Fri, Apr 05, 2002 at 10:42:31PM +0100, Neil Booth wrote:

 > Ah, right, what a shame.  In that case your patch is OK, provided you
 > convert C++ comments to C, and add a testcase containing the 3 cases in
 > my original mail, and any other non-#define directive you like, that
 > they preprocess without diagnostics.   Putting them all in one file
 > should be enough (in gcc.dg/cpp/).

Hm.  Actually, I'd like to clarify what you want, here.

Do you want C++ comments always converted to C?  Or only when saving
comments while processing a directive?

To illustrate, consider:

#define STR "hello world\n" // string

void
main(void)
{

  // C++ comment
  printf(STR);
}

Please pick between the following two options:

 ----- OPTION A -----

void
main(void)
{

  // C++ comment
  printf("hello world" /* string*/);
}

 ----- OPTION B -----

void
main(void)
{

  /* C++ comment*/
  printf("hello world" /* string*/);
}

 ----- snip -----

Either one is easy to do (I've actually implemented both), I just need
you to pick which one you want :-)

(My opionion?  Option A seems like the more correct one...)

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>


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