diff mbox series

[committed] Fix libgomp build with -D_FORTIFY_SOURCE on older glibcs (PR libgomp/93219)

Message ID 20200110204423.GA10088@tucnak
State New
Headers show
Series [committed] Fix libgomp build with -D_FORTIFY_SOURCE on older glibcs (PR libgomp/93219) | expand

Commit Message

Jakub Jelinek Jan. 10, 2020, 8:44 p.m. UTC
Hi!

Older glibcs used to declare fwrite with -D_FORTIFY_SOURCE{,=2} as
warn_unused_result.
The following is just an workaround against that, not really using it in the
end, but just letting the compiler think we are.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2020-01-10  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/93219
	* libgomp.h (gomp_print_string): Change return type from void to int.
	* affinity-fmt.c (gomp_print_string): Likewise.  Return true if
	not all characters have been written.


	Jakub
diff mbox series

Patch

--- libgomp/libgomp.h.jj	2020-01-01 12:22:44.501317101 +0100
+++ libgomp/libgomp.h	2020-01-10 17:56:35.608708963 +0100
@@ -832,7 +832,7 @@  extern void gomp_display_affinity_place
 
 /* affinity-fmt.c */
 
-extern void gomp_print_string (const char *str, size_t len);
+extern bool gomp_print_string (const char *str, size_t len);
 extern void gomp_set_affinity_format (const char *, size_t);
 extern void gomp_display_string (char *, size_t, size_t *, const char *,
 				 size_t);
--- libgomp/affinity-fmt.c.jj	2020-01-01 12:22:44.624315244 +0100
+++ libgomp/affinity-fmt.c	2020-01-10 17:57:39.098773137 +0100
@@ -37,10 +37,10 @@ 
 #include <sys/utsname.h>
 #endif
 
-void
+bool
 gomp_print_string (const char *str, size_t len)
 {
-  fwrite (str, 1, len, stderr);
+  return fwrite (str, 1, len, stderr) != len;
 }
 
 void