public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix libgomp build with -D_FORTIFY_SOURCE on older glibcs (PR libgomp/93219)
@ 2020-01-10 20:46 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-01-10 20:46 UTC (permalink / raw)
  To: gcc-patches

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.

--- 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

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-10 20:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-10 20:46 [committed] Fix libgomp build with -D_FORTIFY_SOURCE on older glibcs (PR libgomp/93219) 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).