* [PATCH] Remove nonnull for 1st arguments to setenv and unsetenv
@ 2004-11-25 23:58 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2004-11-25 23:58 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
http://www.opengroup.org/onlinepubs/009695399/functions/setenv.html
http://www.opengroup.org/onlinepubs/009695399/functions/unsetenv.html
define what happens if these functions are called with NULL as
first argument (return -1 and set errno to EINVAL), therefore it is not
undefined behaviour and we shouldn't be using nonnull attribute there.
As long as that attribute is just a warning, this is not a big
trouble, but as soon as the compiler will start taking advantage
of that attribute in optimization, conforming programs could be
miscompiled.
2004-11-26 Jakub Jelinek <jakub@redhat.com>
* stdlib/stdlib.h (setenv): Use nonnull only for second argument.
(unsetenv): Remove.
--- libc/stdlib/stdlib.h.jj 2004-09-30 00:50:07.000000000 +0200
+++ libc/stdlib/stdlib.h 2004-11-26 00:54:04.391581060 +0100
@@ -669,10 +669,10 @@ extern int putenv (char *__string) __THR
/* Set NAME to VALUE in the environment.
If REPLACE is nonzero, overwrite an existing value. */
extern int setenv (__const char *__name, __const char *__value, int __replace)
- __THROW __nonnull ((1, 2));
+ __THROW __nonnull ((2));
/* Remove the variable NAME from the environment. */
-extern int unsetenv (__const char *__name) __THROW __nonnull ((1));
+extern int unsetenv (__const char *__name) __THROW;
#endif
#ifdef __USE_MISC
Jakub
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-11-25 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-25 23:58 [PATCH] Remove nonnull for 1st arguments to setenv and unsetenv Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).