Skip to contentSkip to conversation

strptime.3: add #define to example to avoid implicit declaration of strptime

PATCH In review Carlo Marcelo Arenas Belon 2 participants 2 messages Jan 6, 2008 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 strptime.3: add #define to example to avoid implicit declaration of strptime

The example doesn't follow the guidelines given in the description and will result in the following warning if compiled :

In function 'main':
13: warning: implicit declaration of function 'strptime'

Carlo
---

man3/strptime.3 +1 -0
diff -urp man-pages-2.74/man3/strptime.3 man-pages-2.74/man3/strptime.3
@@ -384,6 +384,7 @@ and
 .BR strftime (3).
 .sp
 .nf
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>

-
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 5 lines · Carlo Marcelo Arenas Belon

The example doesn't follow the guidelines given in the description and will result in the following warning if compiled :

In function 'main':
13: warning: implicit declaration of function 'strptime'

Hi Carlo,

Thanks for your report. _GNU_SOURCE will do the job, but as documented in the man page, _XOPEN_SOURCE is the precise macro required. So I added that to the example program. The change will be in man-pages-2.76.
Cheers,

Michael

Quoted 13 lines

---
diff -urp man-pages-2.74/man3/strptime.3 man-pages-2.74/man3/strptime.3

man3/strptime.3 2008-01-05 18:46:04.000000000 -0800 renamed from man3/strptime.3 2007-12-20 04:13:45.000000000 -0800 +1 -0
@@ -384,6 +384,7 @@ and
 .BR strftime (3).
 .sp
 .nf
+#define _GNU_SOURCE
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
Signature · 9 lines
Michael Kerrisk
Maintainer of the Linux man-pages project
http://www.kernel.org/doc/man-pages/
Want to report a man-pages bug?  Look here:
http://www.kernel.org/doc/man-pages/reporting_bugs.html
-
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html