mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-22 08:33:43 +00:00
Update to pacify recent GCC's static checking.
These changes pacify gcc 4.8.2-19ubuntu1 on Ubuntu 14.04, and take advantage of recently-added GCC options when compiling with GCC_DEBUG_FLAGS. * Makefile (GCC_DEBUG_FLAGS): Add -Wdeclaration-after-statement, -Wjump-misses-init, -Wsuggest-attribute=format. * date.c (copyright, sccsid): * strftime.c (sccsid): Remove unused vars. * date.c (main): * localtime.c (tzparse): Remove no-longer-needed uses of INITIALIZE; GCC is smart enough to figure these out on its own now. * localtime.c (gmtsub): Redo initialization of gmt_is_set to pacify GCC. Retry malloc next time even if it failed this time. * private.h, zdump.c (GNUC_or_lint): Remove, as it provoked a GCC diagnostic about unused macros in some cases. Instead, just use 'lint'. All uses removed. (TZ_DOMAIN): Don't define unless needed, as otherwise it provokes a GCC diagnostic about unused macros. * private.h (INITIALIZE): Simplify accordingly. * NEWS: Document this.
This commit is contained in:
6
Makefile
6
Makefile
@ -134,14 +134,16 @@ LDLIBS=
|
|||||||
GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
|
GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \
|
||||||
-Wall -Wextra \
|
-Wall -Wextra \
|
||||||
-Wbad-function-cast -Wcast-align -Wcast-qual \
|
-Wbad-function-cast -Wcast-align -Wcast-qual \
|
||||||
-Wformat=2 -Winit-self \
|
-Wdeclaration-after-statement \
|
||||||
|
-Wformat=2 -Winit-self -Wjump-misses-init \
|
||||||
-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
|
-Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes \
|
||||||
-Wnested-externs -Wno-address -Wno-cast-qual \
|
-Wnested-externs -Wno-address -Wno-cast-qual \
|
||||||
-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
|
-Wno-format-nonliteral -Wno-sign-compare -Wno-sign-conversion \
|
||||||
-Wno-type-limits \
|
-Wno-type-limits \
|
||||||
-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
|
-Wno-unused-parameter -Woverlength-strings -Wpointer-arith \
|
||||||
-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
|
-Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \
|
||||||
-Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wtrampolines \
|
-Wsuggest-attribute=format -Wsuggest-attribute=noreturn \
|
||||||
|
-Wsuggest-attribute=pure -Wtrampolines \
|
||||||
-Wwrite-strings
|
-Wwrite-strings
|
||||||
#
|
#
|
||||||
# If you want to use System V compatibility code, add
|
# If you want to use System V compatibility code, add
|
||||||
|
|||||||
2
NEWS
2
NEWS
@ -15,6 +15,8 @@ Unreleased, experimental changes
|
|||||||
Error diagnostics of 'zic' and 'yearistype' have been reworded so that
|
Error diagnostics of 'zic' and 'yearistype' have been reworded so that
|
||||||
they no longer use ASCII '-' as if it were a dash.
|
they no longer use ASCII '-' as if it were a dash.
|
||||||
|
|
||||||
|
Some lint has been removed when using GCC_DEBUG_FLAGS with GCC 4.9.0.
|
||||||
|
|
||||||
Changes affecting documentation and commentary
|
Changes affecting documentation and commentary
|
||||||
|
|
||||||
Documentation and commentary now prefer UTF-8 to US-ASCII,
|
Documentation and commentary now prefer UTF-8 to US-ASCII,
|
||||||
|
|||||||
14
date.c
14
date.c
@ -15,16 +15,6 @@
|
|||||||
* WARRANTIES OF MERCHANT[A]BILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
* WARRANTIES OF MERCHANT[A]BILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
char copyright[] =
|
|
||||||
"@(#) Copyright (c) 1985, 1987, 1988 The Regents of the University of California.\n\
|
|
||||||
All rights reserved.\n";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#ifndef lint
|
|
||||||
static char sccsid[] = "@(#)date.c 4.23 (Berkeley) 9/20/88";
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include "private.h"
|
#include "private.h"
|
||||||
#if HAVE_ADJTIME || HAVE_SETTIMEOFDAY
|
#if HAVE_ADJTIME || HAVE_SETTIMEOFDAY
|
||||||
#include "sys/time.h" /* for struct timeval, struct timezone */
|
#include "sys/time.h" /* for struct timeval, struct timezone */
|
||||||
@ -99,10 +89,6 @@ main(const int argc, char *argv[])
|
|||||||
char * endarg;
|
char * endarg;
|
||||||
|
|
||||||
INITIALIZE(dousg);
|
INITIALIZE(dousg);
|
||||||
INITIALIZE(minuteswest);
|
|
||||||
INITIALIZE(dsttime);
|
|
||||||
INITIALIZE(adjust);
|
|
||||||
INITIALIZE(t);
|
|
||||||
#ifdef LC_ALL
|
#ifdef LC_ALL
|
||||||
(void) setlocale(LC_ALL, "");
|
(void) setlocale(LC_ALL, "");
|
||||||
#endif /* defined(LC_ALL) */
|
#endif /* defined(LC_ALL) */
|
||||||
|
|||||||
@ -944,7 +944,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 */
|
||||||
@ -1368,11 +1367,13 @@ gmtsub(const time_t *const timep, const int_fast32_t offset,
|
|||||||
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);
|
||||||
|
|||||||
28
private.h
28
private.h
@ -352,25 +352,11 @@ 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...
|
||||||
@ -386,9 +372,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
|
||||||
|
|||||||
@ -24,12 +24,6 @@
|
|||||||
** 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"
|
||||||
|
|||||||
16
zdump.c
16
zdump.c
@ -167,16 +167,6 @@ enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
|
|||||||
#include "libintl.h"
|
#include "libintl.h"
|
||||||
#endif /* HAVE_GETTEXT */
|
#endif /* HAVE_GETTEXT */
|
||||||
|
|
||||||
#ifndef GNUC_or_lint
|
|
||||||
#ifdef lint
|
|
||||||
#define GNUC_or_lint
|
|
||||||
#else /* !defined lint */
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define GNUC_or_lint
|
|
||||||
#endif /* defined __GNUC__ */
|
|
||||||
#endif /* !defined lint */
|
|
||||||
#endif /* !defined GNUC_or_lint */
|
|
||||||
|
|
||||||
#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
|
#if 2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)
|
||||||
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
|
# define ATTRIBUTE_PURE __attribute__ ((__pure__))
|
||||||
#else
|
#else
|
||||||
@ -197,9 +187,9 @@ enum { SECSPER400YEARS_FITS = SECSPERLYEAR <= INTMAX_MAX / 400 };
|
|||||||
#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
|
||||||
|
|
||||||
extern char ** environ;
|
extern char ** environ;
|
||||||
extern int getopt(int argc, char * const argv[],
|
extern int getopt(int argc, char * const argv[],
|
||||||
|
|||||||
Reference in New Issue
Block a user