m4-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improve compatibility between M4 and CPP.


From: Eric Blake
Subject: Re: [PATCH] Improve compatibility between M4 and CPP.
Date: Wed, 08 Jul 2009 06:35:09 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

[re-adding m4-discuss, to widen the audience concerning your proposed option]

According to Raphael 'kena' Poss on 7/8/2009 3:16 AM:
> as you suggested I reworked the patch from 1.6, and included documentation
> with example and test code. Let me know if there is anything else to improve.

I probably won't look at this closer until your copyright papers come
through.  But a first very general comment:

POSIX states that 'm4 -s' must:

| Enable line synchronization output for the c99 preprocessor phase (that
| is, #line directives).

If our synclines are not suitable with the c99 preprocessor already, then
we are not compliant with POSIX.  But naming a new option --synclines-cpp
makes it sound like synclines are not c99-ready unless you use this new
option.  That is, until I read your documentation of the option:

> address@hidden --synclines-cpp
> +
> +This provides identical behavior to @option{-s} or @option{--synclines},
> +but with a different synchronization line format suitable for a C
> +compiler without a C preprocessor. With this option synchronization
> +lines are of the form @samp{# @var{line} "@var{file}"}. This format is
> +suitable when M4 is used as a substitute to the C preprocessor or as a
> +filter between preprocessing and compilation.

Which is NOT a cpp-parseable line directive (rather, it is a c99
non-directive), so it is the exact opposite of what you are proposing
naming this option.  Furthermore, there is no standard-compliant C
compiler that does not have a preprocessor; c99 5.1.1.2 states that a
non-directive is discarded between the preprocessing phase (4) and
translation phase (phases 5-8).  So in effect, what it looks like you are
trying to introduce is an option to make m4 line directives NOT affect C99
preprocessing (ie. they will be silently ignored by the c99 preprocessor,
without affecting the c99 magic macros __LINE__ and __FILE__), but still
be recognizable enough for a human reading the file to still correlate the
lines back to previously preprocessed source code.  If that is the case,
then you need a better name than --synclines-cpp; and preferably one that
does not introduce ambiguities so that people can still use 'm4 --sync' as
a shortcut for 'm4 --synclines'.

And if we do add that as an option, we should break this into multiple
patches - one that adds an optional argument to __line__/__file__, and
another patch that introduces the new option, rather than doing it all in
one patch.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpUkn0ACgkQ84KuGfSFAYCsAwCgjdQbb9AP8zpjvm9D8z4X9Mde
U2sAnjESIJ0kS0H1EKRFglCsN9vb7Pnf
=mlqE
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]