room for one more (char*) cast?
applying the recent ALL_STATE patch i noticed a few more (char*) casts go in, but i think we're still one away from a -Werror build: bionic/libc/tzcode/localtime.c: In function 'localsub': 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]; ^ (excuse the slightly-off line numbers. bionic adds a mutex around accesses to the global 'struct tm'.) -- Elliott Hughes - http://who/enh - http://jessies.org/~enh/ Java i18n/JNI/NIO, or bionic questions? Mail me/drop by/add me as a reviewer.
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? 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.
On Wed, Jun 18, 2014 at 11:38 PM, Paul Eggert <eggert@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.
participants (2)
-
enh -
Paul Eggert