View Issue Details

IDProjectCategoryView StatusLast Update
0000043fileGeneralpublic2018-10-01 18:49
Reporterpetk Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version5.34 
Fixed in Version5.35 
Summary0000043: Obsolete HAVE_STDDEF_H symbol
DescriptionThe <stddef.h> header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since file requires at least C89 or greater, the HAVE_STDDEF_H symbol
defined by Autoconf in configure.ac [2] can be ommitted and simplifed.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4

Thank you.
Additional InformationPull request has been opened also at https://github.com/file/file/pull/41 for better overview.
TagsNo tags attached.

Activities

petk

2018-09-16 07:29

reporter  

41.patch (2,120 bytes)   
From f841c2ce5526014dd551f44597ba0d5280ebfeee Mon Sep 17 00:00:00 2001
From: Peter Kokot <peterkokot@gmail.com>
Date: Sun, 16 Sep 2018 09:25:52 +0200
Subject: [PATCH] Remove HAVE_STDDEF_H

The `<stddef.h>` header file is part of the standard C89 headers [1]
and on current systems can be included unconditionally.

Since file requires at least C89 or greater, the `HAVE_STDDEF_H` symbol
defined by Autoconf in `configure.ac` [2] can be ommitted and simplifed.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
---
 configure.ac     | 2 +-
 src/apprentice.c | 2 --
 src/vasprintf.c  | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index ab4f6fc21..cb2e3c62c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,7 +91,7 @@ AC_HEADER_STDC
 AC_HEADER_MAJOR
 AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(stdint.h fcntl.h locale.h stdint.h inttypes.h unistd.h)
-AC_CHECK_HEADERS(stddef.h utime.h wchar.h wctype.h limits.h)
+AC_CHECK_HEADERS(utime.h wchar.h wctype.h limits.h)
 AC_CHECK_HEADERS(getopt.h err.h xlocale.h signal.h)
 AC_CHECK_HEADERS(sys/mman.h sys/stat.h sys/types.h sys/utime.h sys/time.h)
 if test "$enable_zlib" != "no"; then
diff --git a/src/apprentice.c b/src/apprentice.c
index 28a513f66..9ad54dc41 100644
--- a/src/apprentice.c
+++ b/src/apprentice.c
@@ -40,9 +40,7 @@ FILE_RCSID("@(#)$File: apprentice.c,v 1.279 2018/09/09 20:33:28 christos Exp $")
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef HAVE_STDDEF_H
 #include <stddef.h>
-#endif
 #include <string.h>
 #include <assert.h>
 #include <ctype.h>
diff --git a/src/vasprintf.c b/src/vasprintf.c
index 8d0531541..b3927e61e 100644
--- a/src/vasprintf.c
+++ b/src/vasprintf.c
@@ -119,9 +119,7 @@ FILE_RCSID("@(#)$File: vasprintf.c,v 1.15 2018/09/09 20:33:28 christos Exp $")
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
-#ifdef HAVE_STDDEF_H
 #include <stddef.h>
-#endif
 
 #define ALLOC_CHUNK 2048
 #define ALLOC_SECURITY_MARGIN 1024   /* big value because some platforms have very big 'G' exponent */
41.patch (2,120 bytes)   

Issue History

Date Modified Username Field Change
2018-09-16 07:29 petk New Issue
2018-09-16 07:29 petk File Added: 41.patch
2018-10-01 18:49 christos Assigned To => christos
2018-10-01 18:49 christos Status new => assigned
2018-10-01 18:49 christos Status assigned => resolved
2018-10-01 18:49 christos Resolution open => fixed
2018-10-01 18:49 christos Fixed in Version => 5.35