Re: parser option handling

Stefan Seefeld <[email protected]> Sat, 05 May 2007 11:02:18 -0400
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
Hi Bernhard,

Bernhard Fischer wrote:

> %.syn: %.c
>         synopsis -p C -l Comments.SSDFilter,Comments.Previous \
> 		-Wp,preprocess=True,cppflags="'$(SYN_CPPFLAGS)'" -o $@ $<

(Note that 'preprocess=True' by default.)
Starting with the 0.9 release the comment processing is expressed differently:
Use --cprocessor, --cfilter, and --translator with the 'synopsis' tool.

However, note that the whole idea behind the 'synopsis' applet is to make the
most common options available conveniently. It sounds as if you are on the
borderline to more complex needs. You may consider using a synopsis script
(http://synopsis.fresco.org/docs/Tutorial/script.html)

That may be particularly practical if you use an autotools-based build system,
as then you can write a 'synopsis.py.in' template and let configure substitute
variables such as CPPFLAGS etc., so you don't need to deal with shell escaping.


> .PHONY: html
> html: $(syn)
>         synopsis -f HTML -Wf,title="'BusyBox Documentation'" -o $@ $^
> 
> 
> The SYN_CPPFLAGS evaluate to:
> -std=gnu99 -Iinclude -Ilibbb -I/home/cow/src/busybox_trunk/libbb
> -include include/autoconf.h -D_GNU_SOURCE -DNDEBUG -D_LARGEFILE_SOURCE
> -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
> -D"BB_VER=KBUILD_STR\(1.6.0.svn\)" -DBB_BT=AUTOCONF_TIMESTAMP
> 
> This works satisfactorily well with the 0_8 branch.
> Now, with trunk, I'm facing a few issues:
> 
> 1) -std=gnu99
> is currently not accepted but would influence the Cpp behaviour.

Right, and I'm not sure what the best way to handle that is. Synopsis
provides a mechanism to emulate a particular compiler, in particular
in its preprocessing. It may make sense to consider to pass 'gcc -std=gnu99'
as the 'emulate_compiler' option to the Cpp processor, and then let
this sort out what CPP flags that maps to.

> 2) -include
> is currently rejected, only --include is accepted.
> This is, from the looks, merely a getopt-imposed misfeature.

Heh. I wouldn't call it a misfeature. Synopsis unifies the handling of
flags / options in POSIX style, i.e. '--' options are 'long options',
while '-' options are one-letter (short) options. If anything it is
gcc that is broken :-). (I recognize that this may be a matter of compatibility.)

However, knowing this mismatch, it is easy enough to map '-include'
to '--include' prior to passing it to Synopsis.

Regards,
		Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...