[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: string manipulation : removing a part of a string
From: |
Eric Blake |
Subject: |
Re: string manipulation : removing a part of a string |
Date: |
Mon, 18 Jun 2012 07:03:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 |
On 06/15/2012 11:49 PM, Vincent Torri wrote:
>> This can be shortened:
>>
>> m4_pushdef([flagm4], m4_bpatsubst([[$2]], [no-]))
>>
>> since m4_bpatsubst is a no-op if the pattern 'no-' doesn't appear.
>>
> heh, as option=m4_bpatsubst([[$2]], [no-]) is working, there's no need.
> It's so simple when you know how it works...
>
> I finally found the doc of that m4 macro, and it's not mentioned that
> it's a no op in some cases:
>
> http://www.gnu.org/software/autoconf/manual/autoconf.html#Conditional-constructs
>
>
> is it possible to add that ?
Patches welcome, if you think it would help. The current documentation
for m4_bpatsubst() just points to the GNU M4 manual for patsubst():
https://www.gnu.org/software/autoconf/manual/autoconf.html#Redefined-M4-Macros
>
> Also, if I'm not mistaken, there's a typo in the macro name :
>
> m4_bpatsubsts (final s)
> ^
Wrong macro. m4_bpatsubsts() with the final s is a different macro,
with even more power than m4_bpatsubst().
>> m4_foreach_w([flag], [$2],
>> [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
>
> for $1, i was sure, but why is it not needed for m4_defn([flag]) ?
Because you _want_ the m4_defn() to be expanded up front, and because
the output of m4_defn is already quoted for reuse. In other words, you
want to call:
EFL_CHECK_COMPILER_FLAG([efl], [-Wfoo])
EFL_CHECK_COMPILER_FLAG([efl], [-Wno-bar])
and not:
EFL_CHECK_COMPILER_FLAG([efl], [m4_defn([flag])])
EFL_CHECK_COMPILER_FLAG([efl], [m4_defn([flag])])
because the latter wouldn't be checking the right flag names.
--
Eric Blake address@hidden +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- string manipulation : removing a part of a string, Vincent Torri, 2012/06/14
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/14
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/15
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/15
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/15
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/15
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/15
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/15
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/16
- Re: string manipulation : removing a part of a string,
Eric Blake <=
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/18
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/16
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/18
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/18
- Re: string manipulation : removing a part of a string, Eric Blake, 2012/06/18
- Re: string manipulation : removing a part of a string, Vincent Torri, 2012/06/18