fixincl recently broken, char_macro_def/char_macro_use don't work

Bruce Korb bkorb@sco.COM
Tue May 16 14:26:00 GMT 2000


"Kaveh R. Ghazi" wrote:
> The second problem is that I'm getting some failures which look like
> this:
> 
>  > Applying io_quotes_def            to sys/ioccom.h
>  > Match error 1:
>  > ^#[  ]*define[       ]+[_A-Z][A-Z0-9_]*IO[A-Z]*\(([a-zA-Z])[^a-zA-Z0-9_][^)]*\)[     ]+\([   (]*'([a-zA-Z])'

> Here are some of the _IO* definitions from sys/iocccom.h:
> (Would they make good test_text?)

Probably great test_text-s :-)

> #define _IO(x,y)        (_IOC_VOID|('x'<<8)|y)
> #define _IOR(x,y,t)     (_IOC_OUT|((sizeof(t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> #define _IORN(x,y,t)    (_IOC_OUT|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> #define _IOW(x,y,t)     (_IOC_IN|((sizeof(t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> #define _IOWN(x,y,t)    (_IOC_IN|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> /* this should be _IORW, but stdio got there first */
> #define _IOWR(x,y,t)    (_IOC_INOUT|((sizeof(t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> #define _IOWRN(x,y,t)   (_IOC_INOUT|(((t)&_IOCPARM_MASK)<<16)|('x'<<8)|y)
> 
> as you can see, there are many other permutations of allowable
> characters in the macro replacement between the first open paren and
> the single quote.

So maybe use:  "\\(.*'([a-zA-Z])'"
i.e. assume there are no other singly quoted characters on the line?

> Anyway, I'd like your input on the second issue, but here is the patch
> for eliminating sprintf return value checks.

Sorry I missed the sprintf thingey.  Please use "pz_pat" instead of
"zPat" since it is a pointer, not an array of chars.  Thanks!
(i.e., please feel free to apply)

> diff -rup orig/egcs-CVS20000516/gcc/fixinc/fixfixes.c egcs-CVS20000516/gcc/fixinc/fixfixes.c
> --- orig/egcs-CVS20000516/gcc/fixinc/fixfixes.c Tue May 16 10:54:22 2000
> +++ egcs-CVS20000516/gcc/fixinc/fixfixes.c      Tue May 16 12:24:15 2000
> @@ -296,7 +296,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
>  #endif
>      ;
> 
> -  char zPat[ sizeof( zPatFmt ) + 32 ];
< +  char *zPat;
----
> +  char *pz_pat;


More information about the Gcc-bugs mailing list