[tz] room for one more (char*) cast?

enh enh at google.com
Thu Jun 19 20:57:43 UTC 2014


On Wed, Jun 18, 2014 at 11:38 PM, Paul Eggert <eggert at cs.ucla.edu> wrote:
> enh wrote:
>>
>> bionic/libc/tzcode/localtime.c:1357:27: warning: assignment discards
>> 'const' qualifier from pointer target type [enabled by default]
>>       tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
>
>
> Sorry, I don't see how that can happen with the current tzcode; 'sp' is of
> type 'struct state *', so sp->chars is of type 'char *', with no 'const'
> qualifier.  Maybe the bionic version has a 'const' that the tz version
> doesn't, a 'const' that should be removed?

gah, you're right. for legacy reasons we have internal mktime_tz,
localtime_tz, and strftime_tz functions. i hope to get rid of them,
but until then i've fixed the const issues.

> I did try a "make CFLAGS='$(GCC_DEBUG_FLAGS)'" on Ubuntu 14.04 and found
> some opportunities for improvement and simplification in this area.  I
> pushed the attached patch to the experimental version on github to address
> the problems I found.  This patch is also tested with my build of GCC 4.9.0
> on Fedora 20.

thanks. i've applied this to Android's copy. we're now building [our
modified] tzcode with -Werror.


More information about the tz mailing list