View Issue Details

IDProjectCategoryView StatusLast Update
0000042file[All Projects] Generalpublic2018-10-01 18:48
ReporterpetkAssigned Tochristos 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.34 
Target VersionFixed in Version5.35 
Summary0000042: Obsolete HAVE_LOCALE_H symbol
DescriptionThe <locale.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_LOCALE_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 for additional info is at https://github.com/file/file/pull/40
TagsNo tags attached.
Attach Tags

Activities

petk

2018-09-16 07:06

reporter  

40.patch (1,645 bytes)
From 9cfaa5e7aad4a3ae834e02323c3ed9252615b518 Mon Sep 17 00:00:00 2001
From: Peter Kokot <peterkokot@gmail.com>
Date: Sun, 16 Sep 2018 05:48:14 +0200
Subject: [PATCH] Remove HAVE_LOCALE_H

The `<locale.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_LOCALE_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/file.h   | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index ab4f6fc21..b5e2c1c54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,7 +90,7 @@ dnl Checks for headers
 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(stdint.h fcntl.h stdint.h inttypes.h unistd.h)
 AC_CHECK_HEADERS(stddef.h 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)
diff --git a/src/file.h b/src/file.h
index c24e0a903..e0fb9d0e1 100644
--- a/src/file.h
+++ b/src/file.h
@@ -513,9 +513,7 @@ protected void buffer_init(struct buffer *, int, const void *, size_t);
 protected void buffer_fini(struct buffer *);
 protected int buffer_fill(const struct buffer *);
 
-#if defined(HAVE_LOCALE_H)
 #include <locale.h>
-#endif
 #if defined(HAVE_XLOCALE_H)
 #include <xlocale.h>
 #endif
40.patch (1,645 bytes)

christos

2018-09-17 00:37

manager   ~0000073

Have you tried building with visual studio (is it c89?)?

petk

2018-09-17 01:32

reporter   ~0000074

Hello, I haven't build this with Visual Studio but I can check it out via some virtual machine how this works... Visual Studio 2015 and 2017 should both support C89 standard headers, yes. For example:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale?view=vs-2015

Issue History

Date Modified Username Field Change
2018-09-16 07:06 petk New Issue
2018-09-16 07:06 petk File Added: 40.patch
2018-09-17 00:37 christos Note Added: 0000073
2018-09-17 01:32 petk Note Added: 0000074
2018-10-01 18:48 christos Assigned To => christos
2018-10-01 18:48 christos Status new => assigned
2018-10-01 18:48 christos Status assigned => resolved
2018-10-01 18:48 christos Resolution open => fixed
2018-10-01 18:48 christos Fixed in Version => 5.35