bug-m4
[Top][All Lists]
Advanced

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

[sr #110929] Using changequote() breaks --synclines


From: Karl O. Pinc
Subject: [sr #110929] Using changequote() breaks --synclines
Date: Wed, 6 Sep 2023 01:14:10 -0400 (EDT)

URL:
  <https://savannah.gnu.org/support/?110929>

                 Summary: Using changequote() breaks --synclines
                   Group: GNU M4
               Submitter: kop
               Submitted: Wed 06 Sep 2023 05:14:08 AM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 06 Sep 2023 05:14:08 AM UTC By: Karl O. Pinc <kop>
Using the changequote() macro breaks --synclines output.
(And has for years and years, FWIW.)
See the attached files foo.m4 and bar.m4 and output of:
m4 -s foo.m4

Full explaination follows:

-----------------------------------------------------
foo.m4 is:
line 1 of foo
include(bar.m4)
line 3 of foo
include(bar.m4)
line 5 of foo
line 6 of foo
baz()`'dnl
 This text is line 8 of foo
baz()
line 10 of foo
-----------------------------------------------------

bar.m4 is:
-----------------------------------------------------
dnl This is an included file
changequote([{[,]}])dnl m4 foolery so includes include only once.
dnl                     Once the macro is in the text, change the quotes back
ifdef([{[_bar.m4]}], [{[changequote(`,')]}], [{[dnl
changequote(`,')dnl
dnl
dnl Standard test for having already included the file.
define(`_bar.m4')dnl
dnl (Start putting things into the file here)
line 10 of bar
dnl
dnl Don't output anything while defining macros.
line 13 of bar
divert(-1)

# The utility of the changequote foolery is for when included files
# include other files.
# line 18 of bar

define(`baz',
       `The 'b``''`az macro made this')

# Done defining macros.
divert`'dnl
line 25 of bar
]}])dnl End of ifdef over the whole file.
-----------------------------------------------------

The output of `m4 -s foo.m4` is:
-----------------------------------------------------
#line 1 "foo.m4"
line 1 of foo
#line 4 "bar.m4"
line 10 of bar
#line 4
line 13 of bar
#line 4 "bar.m4"
line 25 of bar
#line 2 "foo.m4"

line 3 of foo
#line 4 "foo.m4"

line 5 of foo
line 6 of foo
The baz macro made this This text is line 8 of foo
#line 9
The baz macro made this
line 10 of foo
-----------------------------------------------------

The output should be (something like):
-----------------------------------------------------
#line 1 "foo.m4"
line 1 of foo
#line 10 "bar.m4"
line 10 of bar
#line 13
line 13 of bar
#line 25 "bar.m4"
line 25 of bar
#line 2 "foo.m4"

#line 3
line 3 of foo
#line 4 "foo.m4"

#line 5
line 5 of foo
#line 6
line 6 of foo
The baz macro made this This text is line 8 of foo
#line 21 "bar.m4"
The baz macro made this
#line 10 "foo.m4"
line 10 of foo
-----------------------------------------------------

Apologies, the example may be over-complicated.
It should at least involve direct output by included
files as well as use of a macro defined in an included file.
(I opted not to show included files including other files, but
that should work too.)






    _______________________________________________________
File Attachments:


-------------------------------------------------------
Date: Wed 06 Sep 2023 05:14:08 AM UTC  Name: foo.m4  Size: 148B   By: kop
Use thse to reproduce with: m4 -s foo.m4
<http://savannah.gnu.org/support/download.php?file_id=55118>
-------------------------------------------------------
Date: Wed 06 Sep 2023 05:14:08 AM UTC  Name: bar.m4  Size: 724B   By: kop
Use thse to reproduce with: m4 -s foo.m4
<http://savannah.gnu.org/support/download.php?file_id=55119>

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110929>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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