Cpp patches for VMS

Zack Weinberg zack@codesourcery.com
Tue Nov 13 15:03:00 GMT 2001


On Sat, Nov 17, 2001 at 10:13:22PM -0800, Douglas B. Rupp wrote:
> Please approve.

I'm afraid not.  Most of these changes appear to be papering over
problems, rather than fixing them properly.  For each change, I want
to see a detailed explanation of what problem is being solved, with
test cases, and why you think the change you made is the appropriate fix.

More specifically:

>   /* Suppress warning about function macros used w/o arguments in traditional
>      C.  It is unlikely that glibc's strcmp macro helps this file at all.  */
> + #ifndef VMS /* strcmp defines decc$strcmp on VMS */
>   #undef strcmp
> + #endif

The C library is required to accomodate the user #undef-ing any
identifier that is not specifically described by the standard as a
macro.  strcmp falls into this category.  If VMS' <string.h> is not
standard compliant we'll have to deal, but I very much suspect this is
unnecessary.

>   	      if (count == 0)
>   		{
> + #ifndef VMS /* This warning doesn't apply on VMS */
>   		  cpp_warning (pfile, "%s is shorter than expected", inc->name);
> + #endif

Under Unix, this is a can't-happen situation.  Please describe what
makes VMS files so different that the condition should be silently
ignored.

cppfiles.c is heavily Unix specific, and it may make more sense to
write a completely new variant for VMS.  I am perplexed that you
didn't need to change the path walking logic at all...

> -   new->ino  = st.st_ino;
> +   memcpy (&new->ino, &st.st_ino, sizeof st.st_ino);

I'm aware that VMS inodes are not scalar types, but I would prefer
that you add another macro similar to INO_T_EQ (at the top of the
file) rather than incurring function-call overhead on non-VMS
systems.  Call it INO_T_COPY.  It'd be nice if you would update the
comment there to say more specifically what a VMS ino_t is.

>         else if (c == '\0')
>   	{
> + #ifdef VMS /* Doesn't apply to VMS */
> + 	  ;
> + #else
>   	  if (!warned)
>   	    {
>   	      cpp_warning (pfile, "null character(s) ignored");
>   	      warned = 1;
>   	    }
> + #endif

Um.  VMS puts null characters in files when the user didn't edit them
in (by intent or accident)?  That is a symptom of something else being
seriously wrong.  Most likely, cpplib is not opening/reading the file
properly.  The problem should be fixed there, not here.

Also, the style is wrong; you should have just put "#ifndef VMS"
around the entire contents of the brace group.  A C compound statement
can be completely empty.

> + #ifndef VMS /* Doesn't apply to VMS */
>   	      if (!buffer->from_stage3)
>   		cpp_pedwarn (pfile, "no newline at end of file");
> + #endif

This is a mandatory diagnostic.  You had better have a very good
reason for disabling it.  Again, I suspect you are papering over a
problem with the way we're opening the file.

> !       {
> ! 	/* Don't use fwrite here, produces extraneous newlines on VMS */
> ! 	int i;
> ! 
> ! 	for (i = 0; i < NODE_LEN (token->val.node); i++)
> ! 	  putc (NODE_NAME (token->val.node) [i], fp);
> !       }

If fwrite produces extraneous newlines, either the system stdio
implementation is utterly broken and we shouldn't be using it at all,
or we've failed to set the modes on the output file correctly.  In
any case, inlining this operation is a performance lose in a routine
that already takes too much time.

zw



More information about the Gcc-patches mailing list