[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] lib/argp-ba.c: remove #ifdef
From: |
Guilherme Janczak |
Subject: |
[PATCH v2] lib/argp-ba.c: remove #ifdef |
Date: |
Wed, 6 Jul 2022 02:01:55 +0000 |
On Wed, Jul 06, 2022 at 12:02:23AM +0200, Bruno Haible wrote:
> Since you are apparently speculating on a new compiler, please tell
> starting which version of GCC one can assume that (on ELF platforms)
> const char *x = NULL;
> produce code that is as good as
> const char *x;
My intention there isn't to optimize, but to get rid of an #ifdef. To
me, it seems sensible that without the #ifdef, that source file's
difference from the upstream glibc source will be small enough that they
wouldn't mind commiting it if I sent them the new gnulib version with
the purpose of making both codebases the same, and that using unmodified
glibc source is more important than the performance difference between a
tentative definition and a definition.
> > +const char *argp_program_bug_address = 0;
>
> Also, please don't use 0 to denote a null pointer. That is antiquated
> style from the 1980ies.
Understood.
-- >8 --
I intend to send this file to glibc to make gnulib and glibc source the
same.
---
lib/argp-ba.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/lib/argp-ba.c b/lib/argp-ba.c
index 5e43c75d3..1d9f88e72 100644
--- a/lib/argp-ba.c
+++ b/lib/argp-ba.c
@@ -16,19 +16,16 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+#include <stddef.h>
+
/* If set by the user program, it should point to string that is the
bug-reporting address for the program. It will be printed by argp_help if
the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
messages), embedded in a sentence that says something like "Report bugs to
- ADDR." */
-const char *argp_program_bug_address
-/* This variable should be zero-initialized. On most systems, putting it into
- BSS is sufficient. Not so on Mac OS X 10.3 and 10.4, see
+ ADDR."
+
+ Make sure this is a definition, a tentative definition breaks on Mac OS X
+ 10.3 and 10.4:
<https://lists.gnu.org/r/bug-gnulib/2009-01/msg00329.html>
<https://lists.gnu.org/r/bug-gnulib/2009-08/msg00096.html>. */
-#if defined __ELF__
- /* On ELF systems, variables in BSS behave well. */
-#else
- = (const char *) 0
-#endif
- ;
+const char *argp_program_bug_address = NULL;
--
2.35.1