Merge "Build tzcode with -Werror."

This commit is contained in:
Elliott Hughes 2014-06-19 21:16:37 +00:00 committed by Gerrit Code Review
commit 477b45b89d
4 changed files with 60 additions and 68 deletions

View File

@ -597,6 +597,7 @@ LOCAL_CFLAGS += -DTZDIR=\"/system/usr/share/zoneinfo\"
# Include timezone and daylight globals. # Include timezone and daylight globals.
LOCAL_CFLAGS += -DUSG_COMPAT=1 LOCAL_CFLAGS += -DUSG_COMPAT=1
LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU LOCAL_CFLAGS += -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
LOCAL_CFLAGS += -Dlint -Werror
LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CONLYFLAGS := $(libc_common_conlyflags)
LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_CPPFLAGS := $(libc_common_cppflags)

View File

@ -159,9 +159,9 @@ static const char * getoffset(const char * strp, int_fast32_t * offsetp);
static const char * getrule(const char * strp, struct rule * rulep); static const char * getrule(const char * strp, struct rule * rulep);
static void gmtload(struct state * sp); static void gmtload(struct state * sp);
static struct tm * gmtsub(const time_t * timep, int_fast32_t offset, static struct tm * gmtsub(const time_t * timep, int_fast32_t offset,
struct tm * tmp, const struct state * sp); // android-changed: added sp. struct tm * tmp, struct state * sp); // android-changed: added sp.
static struct tm * localsub(const time_t * timep, int_fast32_t offset, static struct tm * localsub(const time_t * timep, int_fast32_t offset,
struct tm * tmp, const struct state * sp); // android-changed: added sp. struct tm * tmp, struct state * sp); // android-changed: added sp.
static int increment_overflow(int * number, int delta); static int increment_overflow(int * number, int delta);
static int leaps_thru_end_of(int y) ATTRIBUTE_PURE; static int leaps_thru_end_of(int y) ATTRIBUTE_PURE;
static int increment_overflow32(int_fast32_t * number, int delta); static int increment_overflow32(int_fast32_t * number, int delta);
@ -173,16 +173,16 @@ static int normalize_overflow(int * tensptr, int * unitsptr,
static void settzname(void); static void settzname(void);
static time_t time1(struct tm * tmp, static time_t time1(struct tm * tmp,
struct tm * (*funcp)(const time_t *, struct tm * (*funcp)(const time_t *,
int_fast32_t, struct tm *, const struct state *), // android-changed: added state*. int_fast32_t, struct tm *, struct state *), // android-changed: added state*.
int_fast32_t, const struct state * sp); // android-changed: added sp. int_fast32_t, struct state * sp); // android-changed: added sp.
static time_t time2(struct tm * tmp, static time_t time2(struct tm * tmp,
struct tm * (*funcp)(const time_t *, struct tm * (*funcp)(const time_t *,
int_fast32_t, struct tm*, const struct state *), // android-changed: added state*. int_fast32_t, struct tm*, struct state *), // android-changed: added state*.
int_fast32_t offset, int * okayp, const struct state * sp); // android-changed: added sp. int_fast32_t offset, int * okayp, struct state * sp); // android-changed: added sp.
static time_t time2sub(struct tm *tmp, static time_t time2sub(struct tm *tmp,
struct tm * (*funcp) (const time_t *, struct tm * (*funcp) (const time_t *,
int_fast32_t, struct tm*, const struct state *), // android-changed: added state*. int_fast32_t, struct tm*, struct state *), // android-changed: added state*.
int_fast32_t offset, int * okayp, int do_norm_secs, const struct state * sp); // android-change: added sp. int_fast32_t offset, int * okayp, int do_norm_secs, struct state * sp); // android-change: added sp.
static struct tm * timesub(const time_t * timep, int_fast32_t offset, static struct tm * timesub(const time_t * timep, int_fast32_t offset,
const struct state * sp, struct tm * tmp); const struct state * sp, struct tm * tmp);
static int tmcomp(const struct tm * atmp, static int tmcomp(const struct tm * atmp,
@ -945,7 +945,6 @@ tzparse(const char * name, register struct state * const sp,
register int load_result; register int load_result;
static struct ttinfo zttinfo; static struct ttinfo zttinfo;
INITIALIZE(dstname);
stdname = name; stdname = name;
if (lastditch) { if (lastditch) {
stdlen = strlen(name); /* length of standard zone name */ stdlen = strlen(name); /* length of standard zone name */
@ -1284,7 +1283,7 @@ tzset(void)
/*ARGSUSED*/ /*ARGSUSED*/
static struct tm * static struct tm *
localsub(const time_t * const timep, const int_fast32_t offset, localsub(const time_t * const timep, const int_fast32_t offset,
struct tm * const tmp, const struct state * sp) // android-changed: added sp. struct tm * const tmp, struct state * sp) // android-changed: added sp.
{ {
register const struct ttinfo * ttisp; register const struct ttinfo * ttisp;
register int i; register int i;
@ -1390,16 +1389,18 @@ localtime_r(const time_t * const timep, struct tm * tmp)
static struct tm * static struct tm *
gmtsub(const time_t * const timep, const int_fast32_t offset, gmtsub(const time_t * const timep, const int_fast32_t offset,
struct tm *const tmp, const struct state * sp __unused) // android-changed: added sp. struct tm *const tmp, struct state * sp __unused) // android-changed: added sp.
{ {
register struct tm * result; register struct tm * result;
if (!gmt_is_set) { if (!gmt_is_set) {
gmt_is_set = TRUE;
#ifdef ALL_STATE #ifdef ALL_STATE
gmtptr = malloc(sizeof *gmtptr); gmtptr = malloc(sizeof *gmtptr);
gmt_is_set = gmtptr != NULL;
#else
gmt_is_set = TRUE;
#endif /* defined ALL_STATE */ #endif /* defined ALL_STATE */
if (gmtptr != NULL) if (gmt_is_set)
gmtload(gmtptr); gmtload(gmtptr);
} }
result = timesub(timep, offset, gmtptr, tmp); result = timesub(timep, offset, gmtptr, tmp);
@ -1710,10 +1711,10 @@ tmcomp(register const struct tm * const atmp,
static time_t static time_t
time2sub(struct tm * const tmp, time2sub(struct tm * const tmp,
struct tm *(*const funcp)(const time_t*, int_fast32_t, struct tm*, const struct state*), struct tm *(*const funcp)(const time_t*, int_fast32_t, struct tm*, struct state*),
const int_fast32_t offset, const int_fast32_t offset,
int * const okayp, int * const okayp,
const int do_norm_secs, const struct state * sp) // android-changed: added sp const int do_norm_secs, struct state * sp) // android-changed: added sp
{ {
register int dir; register int dir;
register int i, j; register int i, j;
@ -1848,7 +1849,7 @@ time2sub(struct tm * const tmp,
*/ */
// BEGIN android-changed: support user-supplied sp // BEGIN android-changed: support user-supplied sp
if (sp == NULL) { if (sp == NULL) {
sp = (const struct state *) sp = (struct state *)
((funcp == localsub) ? lclptr : gmtptr); ((funcp == localsub) ? lclptr : gmtptr);
} }
// END android-changed // END android-changed
@ -1889,9 +1890,9 @@ label:
static time_t static time_t
time2(struct tm * const tmp, time2(struct tm * const tmp,
struct tm * (*const funcp)(const time_t *, int_fast32_t, struct tm *, const struct state *), // android-changed: added sp. struct tm * (*const funcp)(const time_t *, int_fast32_t, struct tm *, struct state *), // android-changed: added sp.
const int_fast32_t offset, const int_fast32_t offset,
int *const okayp, const struct state* sp) // android-changed: added sp. int *const okayp, struct state* sp) // android-changed: added sp.
{ {
time_t t; time_t t;
@ -1906,8 +1907,8 @@ time2(struct tm * const tmp,
static time_t static time_t
time1(struct tm * const tmp, time1(struct tm * const tmp,
struct tm * (* const funcp) (const time_t *, int_fast32_t, struct tm *, const struct state *), // android-changed: added sp. struct tm * (* const funcp) (const time_t *, int_fast32_t, struct tm *, struct state *), // android-changed: added sp.
const int_fast32_t offset, const struct state * sp) // android-changed: added sp. const int_fast32_t offset, struct state * sp) // android-changed: added sp.
{ {
register time_t t; register time_t t;
register int samei, otheri; register int samei, otheri;
@ -1944,7 +1945,7 @@ time1(struct tm * const tmp,
*/ */
// BEGIN android-changed: support user-supplied sp. // BEGIN android-changed: support user-supplied sp.
if (sp == NULL) { if (sp == NULL) {
sp = (const struct state *) ((funcp == localsub) ? lclptr : gmtptr); sp = (struct state *) ((funcp == localsub) ? lclptr : gmtptr);
} }
// BEGIN android-changed // BEGIN android-changed
if (sp == NULL) if (sp == NULL)

View File

@ -19,7 +19,7 @@
/* /*
** Defaults for preprocessor symbols. ** Defaults for preprocessor symbols.
** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'. ** You can override these in your C compiler options, e.g. '-DHAVE_ADJTIME=0'.
*/ */
#ifndef HAVE_ADJTIME #ifndef HAVE_ADJTIME
@ -62,9 +62,11 @@
#define HAVE_UTMPX_H 0 #define HAVE_UTMPX_H 0
#endif /* !defined HAVE_UTMPX_H */ #endif /* !defined HAVE_UTMPX_H */
#if !defined(__ANDROID__)
#ifndef LOCALE_HOME #ifndef LOCALE_HOME
#define LOCALE_HOME "/usr/lib/locale" #define LOCALE_HOME "/usr/lib/locale"
#endif /* !defined LOCALE_HOME */ #endif /* !defined LOCALE_HOME */
#endif // __ANDROID__
#if HAVE_INCOMPATIBLE_CTIME_R #if HAVE_INCOMPATIBLE_CTIME_R
#define asctime_r _incompatible_asctime_r #define asctime_r _incompatible_asctime_r
@ -120,8 +122,9 @@
*/ */
#ifndef HAVE_STDINT_H #ifndef HAVE_STDINT_H
#define HAVE_STDINT_H \ #define HAVE_STDINT_H \
(199901 <= __STDC_VERSION__ || \ (199901 <= __STDC_VERSION__ \
2 < (__GLIBC__ + (0 < __GLIBC_MINOR__))) || 2 < __GLIBC__ + (1 <= __GLIBC_MINOR__) \
|| __CYGWIN__)
#endif /* !defined HAVE_STDINT_H */ #endif /* !defined HAVE_STDINT_H */
#if HAVE_STDINT_H #if HAVE_STDINT_H
@ -205,6 +208,10 @@ typedef unsigned long uintmax_t;
#define INT32_MIN (-1 - INT32_MAX) #define INT32_MIN (-1 - INT32_MAX)
#endif /* !defined INT32_MIN */ #endif /* !defined INT32_MIN */
#ifndef SIZE_MAX
#define SIZE_MAX ((size_t) -1)
#endif
#if 2 < __GNUC__ + (96 <= __GNUC_MINOR__) #if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define ATTRIBUTE_CONST __attribute__ ((const)) # define ATTRIBUTE_CONST __attribute__ ((const))
# define ATTRIBUTE_PURE __attribute__ ((__pure__)) # define ATTRIBUTE_PURE __attribute__ ((__pure__))
@ -347,29 +354,15 @@ static time_t const time_t_max =
** INITIALIZE(x) ** INITIALIZE(x)
*/ */
#ifndef GNUC_or_lint
#ifdef lint #ifdef lint
#define GNUC_or_lint # define INITIALIZE(x) ((x) = 0)
#endif /* defined lint */ #else
#ifndef lint # define INITIALIZE(x)
#ifdef __GNUC__ #endif
#define GNUC_or_lint
#endif /* defined __GNUC__ */
#endif /* !defined lint */
#endif /* !defined GNUC_or_lint */
#ifndef INITIALIZE
#ifdef GNUC_or_lint
#define INITIALIZE(x) ((x) = 0)
#endif /* defined GNUC_or_lint */
#ifndef GNUC_or_lint
#define INITIALIZE(x)
#endif /* !defined GNUC_or_lint */
#endif /* !defined INITIALIZE */
/* /*
** For the benefit of GNU folk... ** For the benefit of GNU folk...
** `_(MSGID)' uses the current locale's message library string for MSGID. ** '_(MSGID)' uses the current locale's message library string for MSGID.
** The default is to use gettext if available, and use MSGID otherwise. ** The default is to use gettext if available, and use MSGID otherwise.
*/ */
@ -381,9 +374,9 @@ static time_t const time_t_max =
#endif /* !HAVE_GETTEXT */ #endif /* !HAVE_GETTEXT */
#endif /* !defined _ */ #endif /* !defined _ */
#ifndef TZ_DOMAIN #if !defined TZ_DOMAIN && defined TZ_DOMAINDIR
#define TZ_DOMAIN "tz" # define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */ #endif
#if HAVE_INCOMPATIBLE_CTIME_R #if HAVE_INCOMPATIBLE_CTIME_R
#undef asctime_r #undef asctime_r

View File

@ -1,12 +1,9 @@
#ifndef lint
#ifndef NOID
static char elsieid[] = "@(#)strftime.c 8.1";
/* /*
** Based on the UCB version with the ID appearing below. ** Based on the UCB version with the copyright notice and sccsid
** appearing below.
**
** This is ANSIish only when "multibyte character == plain character". ** This is ANSIish only when "multibyte character == plain character".
*/ */
#endif /* !defined NOID */
#endif /* !defined lint */
#include "private.h" #include "private.h"
@ -22,35 +19,27 @@ static char elsieid[] = "@(#)strftime.c 8.1";
** by the University of California, Berkeley. The name of the ** by the University of California, Berkeley. The name of the
** University may not be used to endorse or promote products derived ** University may not be used to endorse or promote products derived
** from this software without specific prior written permission. ** from this software without specific prior written permission.
** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ** THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/ */
#ifndef LIBC_SCCS
#ifndef lint
static const char sccsid[] = "@(#)strftime.c 5.4 (Berkeley) 3/14/89";
#endif /* !defined lint */
#endif /* !defined LIBC_SCCS */
#include "tzfile.h" #include "tzfile.h"
#include "fcntl.h" #include "fcntl.h"
#include "locale.h" #include "locale.h"
#include <ctype.h>
#if __ANDROID__
/* Android: struct lc_time_T is defined as strftime_locale in "bionic_time.h" */
#include "private/bionic_time.h" /* for strftime_tz */
#define lc_time_T strftime_locale
#if defined(__LP64__) #if defined(__LP64__)
#define time64_t time_t #define time64_t time_t
#define mktime64 mktime #define mktime64 mktime
#else #else
#include <time64.h> #include <time64.h>
#endif #endif
#include "private/bionic_time.h" /* for strftime_tz */ #include <ctype.h>
#else // not __ANDROID__
/* struct lc_time_T is now defined as strftime_locale
* in <time.h>
*/
#if 1
#define lc_time_T strftime_locale
#else
struct lc_time_T { struct lc_time_T {
const char * mon[MONSPERYEAR]; const char * mon[MONSPERYEAR];
const char * month[MONSPERYEAR]; const char * month[MONSPERYEAR];
@ -65,7 +54,15 @@ struct lc_time_T {
}; };
#endif #endif
#if LOCALE_HOME
#include "sys/stat.h"
static struct lc_time_T localebuf;
static struct lc_time_T * _loc(void);
#define Locale _loc()
#endif /* defined LOCALE_HOME */
#ifndef LOCALE_HOME
#define Locale (&C_time_locale) #define Locale (&C_time_locale)
#endif /* !defined LOCALE_HOME */
static const struct lc_time_T C_time_locale = { static const struct lc_time_T C_time_locale = {
{ {