[Top][All Lists]

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

Re: m4_pattern_forbid

From: Eric Blake
Subject: Re: m4_pattern_forbid
Date: Thu, 12 Mar 2015 16:51:06 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 03/12/2015 04:36 PM, Matěj Týč wrote:
> Hello,
> I am doing some m4sugar programming and I found the m4_pattern_forbid
> insufficient.
> As we all know, there are many kinds of regular expression in different
> programs and even on different OSs (grep, vim, Python, linux sed, osx
> sed, ...). So my question is - where should I look to learn what kind of
> regular expression I can specify to that macro?

It is an extended regular expression according to what perl understands
(which is similar to what 'grep -E' understands).

> Interestingly, I took a look at the autoconf/m4sugar/m4sugar.m4:2005 to
> learn the definition and I was surprised by what I have found there:
> # m4_pattern_forbid(ERE, [WHY])
> # -----------------------------
> # Declare that no token matching the forbidden extended regular
> # expression ERE should be seen in the output unless...
> m4_define([m4_pattern_forbid], [])
> I was unable to find the true macro's definition anywhere, so here is
> the second question: How (and where) is m4_pattern_forbid defined?

That's exactly where it is defined in m4.  What you are really looking
for is the code that traces all no-op uses of that definition and then
greps the output for those forbidden patterns.  For that, look at
bin/, for 'sub warn_forbidden'.  It is one of several m4sugar
constructs that is done by the autom4te perl wrapper that invokes m4 and
post-processes the output, rather than directly by m4.

Would you like to propose a documentation patch to make it clear that
the flavor of regex in use by this macro is what perl understands?

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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