[PATCH] stdio: don't redefine __USE_MINGW_ANSI_STDIO

2016-09-16 Thread Paul Eggert
* m4/stdio_h.m4 (gl_STDIO_H): Don't define __USE_MINGW_ANSI_STDIO
if it is already defined.  Apparently GNU Emacs relies on this.  See:
http://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00416.html
---
 ChangeLog |  7 +++
 m4/stdio_h.m4 | 10 --
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8d0b408..6609e2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-16  Paul Eggert  
+
+   stdio: don't redefine __USE_MINGW_ANSI_STDIO
+   * m4/stdio_h.m4 (gl_STDIO_H): Don't define __USE_MINGW_ANSI_STDIO
+   if it is already defined.  Apparently GNU Emacs relies on this.  See:
+   http://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00416.html
+
 2016-09-15  Eric Blake  
 
sys_types: avoid glibc 2.25 warnings about major()
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 5149981..eaa25a0 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 47
+# stdio_h.m4 serial 48
 dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,13 @@ dnl with or without modifications, as long as this notice is 
preserved.
 
 AC_DEFUN([gl_STDIO_H],
 [
-  AC_DEFINE([__USE_MINGW_ANSI_STDIO], 1, [Use GNU style printf and scanf.])
+  AH_VERBATIM([MINGW_ANSI_STDIO],
+[/* Use GNU style printf and scanf.  */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
+])
+  AC_DEFINE([__USE_MINGW_ANSI_STDIO])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_NEXT_HEADERS([stdio.h])
 
-- 
2.7.4




Re: [Emacs-diffs] master updated (3c586e1 -> 0bbf00c)

2016-09-16 Thread Paul Eggert

Eli Zaretskii wrote:

I don't like the idea that Gnulib should dictate whether Emacs uses
this MinGW feature or not.  If there are good reasons for that (can
you tell what they are?),


Setting __USE_MINGW_ANSI_STDIO is part of Gnulib's usual desire to support a 
GNU-like environment even on non-GNU hosts.


Formerly, defining __USE_MINGW_ANSI_STDIO to 1 was done by 
AC_USE_SYSTEM_EXTENSIONS (defined in m4/extensions.m4), but as this is not 
really a system extension I recently moved that definition to gl_STDIO_H 
(defined in m4/stdio_h.m4). When I did this I used a simple AC_DEFINE to 1, as I 
assumed this would suffice. Evidently it does not work for Emacs, so I just now 
adjusted the moved version in Emacs master (and in Gnulib) to look more like the 
original, as per the attached Emacs patch.
From e95f7f74203d165bbaec8f5cf29ecc7758b974f0 Mon Sep 17 00:00:00 2001
From: Paul Eggert 
Date: Fri, 16 Sep 2016 00:55:40 -0700
Subject: [PATCH] Update from gnulib

This incorporates:
2016-09-16 extensions: fix typo in comment
2016-09-16 stdio: don't redefine __USE_MINGW_ANSI_STDIO
* m4/extensions.m4, m4/stdio_h.m4: Copy from gnulib.
---
 m4/extensions.m4 |  2 +-
 m4/stdio_h.m4| 10 --
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 3a556b1..e114a6f 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,4 +1,4 @@
-# serial 14  -*- Autoconf -*-
+# serial 15  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
 # Copyright (C) 2003, 2006-2016 Free Software Foundation, Inc.
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 5149981..eaa25a0 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,4 +1,4 @@
-# stdio_h.m4 serial 47
+# stdio_h.m4 serial 48
 dnl Copyright (C) 2007-2016 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -6,7 +6,13 @@
 
 AC_DEFUN([gl_STDIO_H],
 [
-  AC_DEFINE([__USE_MINGW_ANSI_STDIO], 1, [Use GNU style printf and scanf.])
+  AH_VERBATIM([MINGW_ANSI_STDIO],
+[/* Use GNU style printf and scanf.  */
+#ifndef __USE_MINGW_ANSI_STDIO
+# undef __USE_MINGW_ANSI_STDIO
+#endif
+])
+  AC_DEFINE([__USE_MINGW_ANSI_STDIO])
   AC_REQUIRE([gl_STDIO_H_DEFAULTS])
   gl_NEXT_HEADERS([stdio.h])
 
-- 
2.7.4



Re: [Emacs-diffs] master updated (3c586e1 -> 0bbf00c)

2016-09-16 Thread Eli Zaretskii
> Cc: emacs-de...@gnu.org, Gnulib bugs 
> From: Paul Eggert 
> Date: Fri, 16 Sep 2016 00:58:04 -0700
> 
> > I don't like the idea that Gnulib should dictate whether Emacs uses
> > this MinGW feature or not.  If there are good reasons for that (can
> > you tell what they are?),
> 
> Setting __USE_MINGW_ANSI_STDIO is part of Gnulib's usual desire to support a 
> GNU-like environment even on non-GNU hosts.

Ah, okay.  My interpretation of that is that we don't need to define
that symbol, as long as there's no specific reason why we should do
so.  When we decide to use it, it should be defined in nt/inc/ms-w32.h
before _mingw.h is included.

> Formerly, defining __USE_MINGW_ANSI_STDIO to 1 was done by 
> AC_USE_SYSTEM_EXTENSIONS (defined in m4/extensions.m4), but as this is not 
> really a system extension I recently moved that definition to gl_STDIO_H 
> (defined in m4/stdio_h.m4). When I did this I used a simple AC_DEFINE to 1, 
> as I 
> assumed this would suffice. Evidently it does not work for Emacs, so I just 
> now 
> adjusted the moved version in Emacs master (and in Gnulib) to look more like 
> the 
> original, as per the attached Emacs patch.

Thanks, the warnings are gone.



Higher accuracy output from human_readable()

2016-09-16 Thread Darshit Shah

Hi,

I'm trying to use the human_readable() method from module human. I am 
currently using it with the following options:


human_autoscale | human_base_1024 | human_SI | human_B | \
human_round_to_nearest | human_group_digits

It shows the value correctly with one decimal point up to 10 MiB. Beyond 
that, the function always returns a value without any decimal points. I 
would like the function to always return a value with 2 decimal points, 
even if it means returning xx.00 MiB for example. How can I achieve this 
using the module?


--
Thanking You,
Darshit Shah
PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6


signature.asc
Description: PGP signature


Re: Higher accuracy output from human_readable()

2016-09-16 Thread Paul Eggert

On 09/15/2016 02:54 PM, Darshit Shah wrote:
would like the function to always return a value with 2 decimal 
points, even if it means returning xx.00 MiB for example. How can I 
achieve this using the module?


It doesn't support that now. I suppose you could add an option