This is the mail archive of the gcc-bugs@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]

Re: Fixing headers


 


Mark Mitchell wrote:
> 
> Here's another header fix that shouldn't be done.  On RH6.1, in
> /usr/include/rpc/svc.h, there is:
[[...]]
> The "fixed" header looks like:
[[...]]
>  *      u_long vers;
> 
> #ifdef __cplusplus
>  *      void (*dispatch)(...);
> #else
>  *      void (*dispatch)();
> #endif
>  *      u_long protocol;  like TCP or UDP, zero means do not register
>  */
> 
> That's pretty gratuitous -- we're inside a comment.

Yep.  It is "fixed" with a sed script.  Sed does not keep context.
Please feel free to make a suggestion.  The proper fix in sed
is going to be extremely complex.  OTOH, you could insert a space
in the comment, thus:

>  *      void (*dispatch)( );

Assuming we have control of the header, that would
certainly be the easiest fix.  This is the current
spec for the fix:

  /*
   *  Apply fix this to all OSs since this problem seems to effect
   *  more than just SunOS.
   */
  fix = {
    hackname = sun_auth_proto;
    files    = rpc/auth.h;
    files    = rpc/clnt.h;
    files    = rpc/svc.h;
    files    = rpc/xdr.h;
    /*
     *  Select those files containing '(*name)()'.
     */
    select   = '\(\*[a-z][a-z_]*\)\(\)';
    sed      = 's'
                '/^\(.*(\*[a-z][a-z_]*)(\)'      '\();.*\)'
                "/\\\n"
                    "#ifdef __cplusplus\\\n"
                    '\1...\2' "\\\n"
                    "#else\\\n"
                    '\1\2' "\\\n"
                    "#endif"
                "/";
  };



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