On Mon, Sep 01, 2025 at 12:43:23PM -0400, Thomas Dickey wrote:
> On Tue, Aug 26, 2025 at 06:46:07PM -0400, Thomas Dickey wrote:
> > On Tue, Aug 26, 2025 at 07:07:57PM +0200, наб wrote:
> > > Package: cproto
> > > Version: 4.7x-1
> > > Severity: normal
> > > 
> > > Dear Maintainer,
> > > 
> > > I'm trying to work around some explosive source code (src:tgif 1:4.2.5-2)
> > > with something like
> > >   cproto -E 'cpp' -D'ARGS_DECL(...)=__VA_ARGS__' -{P,F,C}"int f(a, b)" -a 
> > > exec.c
> > > 
> > > Quoth cproto(1):
> > >   -E cpp Pipe the input files through the specified C preprocessor 
> > > command 
> > >          when generating prototypes.  By default, the program uses 
> > > /lib/cpp.
> > 
> > ...actually the manpage could be improved, to show the actual compiled-in
> > default.
> > 
> > >   -E 0   Do not run the C preprocessor.
> > > 
> > > This doesn't appear to hold at all. /lib/cpp isn't a valid preprocessor,
> > > but even supplying -E cpp or -E /bin/cpp I see no preprocessing happen
> > > (and don't see an execve() in strace at all).
> > 
> > cproto's using popen.
> > 
> > (I agree, it should re-escape/re-quote parameters -- it seems that noone's
> > recently bit on this).
> 
> Actually, it does quote parameters.  The problem is the -a option,
> which isn't readily addressed.  If cproto is told to use the -a or -t
> options, it works only for the unpreprocessed source.  But since
> cproto has only a very limited ability to handle preprocess-related
> stuff, it cannot find the header files, nor can it expand macros by
> itself.
> 
> I'll document this in the manpage.

The manpage does say this:

BUGS
...
       The program does not pipe the source files through the  C  preprocessor
       when  it is converting function definitions.  Instead, it tries to han‐
       dle preprocessor directives and macros itself and can  be  confused  by
       tricky macro expansions.  The conversion also discards some comments in
       the function definition head.

so I'll try to improve the explanation.

-- 
Thomas E. Dickey <[email protected]>
https://invisible-island.net

Attachment: signature.asc
Description: PGP signature

Reply via email to