[top-posting on technical lists makes it harder to follow the conversation]

On 04/29/2016 09:17 AM, Nidhin Joseph wrote:
> Hi,
>  Yes. I understand your point. But I would like to clear one more doubt. Is
> it possible to prevent macro expansion if the key is quoted?
> 
> For example,
>   - getApproximateValue(MY_CUSTOM_KEY) should be converted to
> getApproximateValue(50)
>   - getApproximateValue("MY_CUSTOM_KEY") should remain as
> getApproximateValue("MY_CUSTOM_KEY")

The only way to make M4 not do macro expansion is to use m4 quotes; if
your source file uses

getApproximateValue(`"MY_CUSTOM_KEY"')

(assuming you didn't use changequote() to change the m4 quoting to
something else), then the expansion will be:

getApproximateValue("MY_CUSTOM_KEY")

regardless of whether MY_CUSTOM_KEY is a macro.  But unlike the C
preprocessor, m4 does not have a way to identify C strings where macros
are not to be expanded.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to