libtool-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Cwrapper should not eat -- arguments


From: Charles Wilson
Subject: Re: [PATCH] Cwrapper should not eat -- arguments
Date: Wed, 28 May 2008 19:17:36 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

Olly Betts wrote:
On 2008-05-25, Charles Wilson <address@hidden> wrote:
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5

If the idea is that the user can change LTWRAPPER_OPTION_PREFIX, then
hard-coding the length risks a mismatch if they fail to update
LTWRAPPER_OPTION_PREFIX_LENGTH as well (or update it incorrectly).

It's not really intended that this value be changed *by editing the source code*. Eventually, maybe, we might have a configure-time flag or a configure.ac-settable value for the prefix, and then func_emit_cwrapper_src() would do something like

...stuff...
EOF
        local_length=`echo $var | awk '{print length($0)}'`
        cat <<EOF
#define LTWRAPPER_OPTION_PREFIX "$var"
#define LTWRAPPER_OPTION_PREFIX_LENGTH $local_length
EOF
...stuff...

Perhaps this would be better:

#define LTWRAPPER_OPTION_PREFIX_LENGTH (sizeof(LTWRAPPER_OPTION_PREFIX) - 1)

Or if you're worried LTWRAPPER_OPTION_PREFIX might get changed to be a
pointer and want a compile-time error in that case:

#define LTWRAPPER_OPTION_PREFIX_LENGTH (sizeof(LTWRAPPER_OPTION_PREFIX"") - 1)

That would work, too. But I don't see the need to change it right now, because (as I said above) it is not intended that this #define be changed by the user directly. (Besides, they would be very hard pressed to do so: the lt-foo.c wrapper source code is generated, compiled, and deleted all at once during the target exe's link phase. They'd actually have to edit ltmain.m4sh itself to modify this...and if tbey know that much, they know enough to count bytes correctly, and who to blame when they don't...)

--
Chuck




reply via email to

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