bug-libunistring
[Top][All Lists]
Advanced

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

[bug-libunistring] Re: gnulib integration


From: Pádraig Brady
Subject: [bug-libunistring] Re: gnulib integration
Date: Tue, 14 Sep 2010 12:57:29 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 14/09/10 12:32, Bruno Haible wrote:
> Hi Pádraig,
> 
>> When I was first testing
>> it I noticed that once I used gl_LIBUNISTRING
>> then I needed to link printf with libunistring to
>> get u8_uctomb_aux
> 
> This is normal and expected. gl_LIBUNISTRING is the macro of the
> 'libunistring' modules, and this module description specifies:
> 
>   Link:
>   $(LTLIBUNISTRING) when linking with libtool, $(LIBUNISTRING) otherwise
> 
> So, you need to link every coreutils program that uses the <unistr.h> or
> similar include files with $(LIBUNISTRING).

That's fair enough. However there is a 16% startup overhead
when linking `printf` against libunistring as tested with:
  time seq 1000 | xargs -n1 ./printf
It's a pity that this overhead is introduced just for u8_uctomb_aux().
I was just wondering if there was an easy way to use the gnulib version
of this function, even if libunistring is installed and
I include the libunistring module.

>> I noticed that unistr.h 
>> was not generated by gnulib, and instead the
>> libunistring version was used.
>>
>> In recent testing (probably since support for
>> libunistring-optional was added?) unistr.h is
>> now generated by gnulib even in the case when
>> using libunistring.
> 
> Yes, these mechanics changed a lot when the 'libunistring-optional'
> module was introduced. The principle holds, though, that when you use
> the contents of a module, you also have to honor the contents of the
> 'Link:' field of the module description.
> 
>> Now I have the additional "issue" that I must
>> include the unistr/u8-mbtouc-unsafe module
>> if I want to use that function in my code.
> 
> I'm not sure I understand the issue.
> 
> When you use the 'libunistring' module, you should be able to use
> any functionality from libunistring without asking for gnulib modules.
> But then you need to conditionalize these uses upon
>   #if HAVE_LIBUNISTRING
> (unless you make libunistring an explicit prerequisite of coreutils).

That's as I understand it.

>> So in summary, is the required inclusion of the
>> unistr/u8-mbtouc-unsafe module expected,
> 
> If you use the u8_mbtouc_unsafe function and the 'libunistring-optional'
> module, then yes, you need to request the 'unistr/u8-mbtouc-unsafe' module.
> If not, then not.

I'm not using the 'libunistring-optional' module for the moment.
When building using the 'libunistring' module with libunistring installed,
I get a compile warning saying u8_mbtouc_unsafe() is undeclared,
which is because it's ifdefed out in gnulib/lib/unistr.h
To get the declaration back I need to explicitly include
the 'unistr/u8-mbtouc-unsafe' module, which as you describe
above I shouldn't need to do.

cheers,
Pádraig.



reply via email to

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