Disabling warn_unused_result warnings on a case-by-case basis
A long time ago, GCC decided that warn_unused_result warnings should *not* be silenced by casting to void, as in: (void) write (STDOUT_FILENO, message, strlen (message)); Apparently, programmers have figured out to use this idiom as a replacement: if (write (STDOUT_FILENO, message, strlen (message))) { } I'm not sure if this is an improvement. The (void) idiom seems to make the programmer intention more explicit. Maybe it's time to reconsider and suppress the warning for casts to (void), too? Thanks, Florian
Re: Disabling warn_unused_result warnings on a case-by-case basis
On 14/06/16 10:32, Florian Weimer wrote: A long time ago, GCC decided that warn_unused_result warnings should *not* be silenced by casting to void, as in: (void) write (STDOUT_FILENO, message, strlen (message)); Apparently, programmers have figured out to use this idiom as a replacement: if (write (STDOUT_FILENO, message, strlen (message))) { } I'm not sure if this is an improvement. The (void) idiom seems to make the programmer intention more explicit. Maybe it's time to reconsider and suppress the warning for casts to (void), too? Yes there a ways to suppress the warning, like: http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/ignore-value.h;hb=HEAD It would be great to have the standard (void) mechanism work. It is an explicit request from the programmer after all. thanks, Pádraig
Re: (Problems with) coexistence of target and offloading compiler installations
On Fri, Jun 10, 2016 at 11:31:33 +0200, Jakub Jelinek wrote: > On Fri, Jun 10, 2016 at 09:39:02AM +0200, Thomas Schwinge wrote: > > But I'm actually confused as to seeing libgomp.so in that list -- given > > the conflict of which compiler installations' libgomp.so "wins", I wonder > > how it can be working that some of the functions in there are supposed to > > behave differently on/are compiled differently for target vs. offloading > > target? Or did I do/understand something wrong? For a lot of other > > For intelmic offloading, I believe all the libraries should be the same > (unless one chooses e.g. different tuning or ISA in between the two compiler > installations), including libgomp, so one should be able to just use the > libraries from the primary compiler. At least that has been the goal, > omp_is_initial_device should be handled by overriding the symbol in the > magic executable. Right, currently there is no difference between host and mic libraries in gcc. > For emul certainly, for XeonPhi KNL PCIe HW, I haven't had a possibility to > see > it in action yet, so I don't know how exactly is the filesystem typically > handled, if the offloading device has e.g. NFS mount of the host's > filesystem, or if all the libraries are always copied over on demand over > the bus, whatever. Some libraries are copied during the boot of the card (e.g. libc.so), others are copied during the first offload from the app (e.g. libgomp.so). -- Ilya
Re: Disabling warn_unused_result warnings on a case-by-case basis
On 14/06/16 10:32, Florian Weimer wrote: A long time ago, GCC decided that warn_unused_result warnings should *not* be silenced by casting to void, as in: (void) write (STDOUT_FILENO, message, strlen (message)); Apparently, programmers have figured out to use this idiom as a replacement: if (write (STDOUT_FILENO, message, strlen (message))) { } I'm not sure if this is an improvement. The (void) idiom seems to make the programmer intention more explicit. Maybe it's time to reconsider and suppress the warning for casts to (void), too? There is a thorough discussion and some analysis here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 I think most of the pushback against the (void) idiom has actually come from GNU libc in the past. One possible solution, if both behaviours are desired, is to warn for the void idiom only for a new -Wstrict-unused-result, such that: write (STDOUT_FILENO, message, strlen (message)); // warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result] (void) write (STDOUT_FILENO, message, strlen (message)); // warning: ignoring return value of ‘foo’, declared with attribute warn_unused_result [-Wstrict-unused-result] and -Wno-strict-unused-result disables warnings for (void). But perhaps it is simpler to just change the default. It seems unlikely to use (void) unintentionally. Cheers, Manuel.
gcc-5-20160614 is now available
Snapshot gcc-5-20160614 is now available on ftp://gcc.gnu.org/pub/gcc/snapshots/5-20160614/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 5 SVN branch with the following options: svn://gcc.gnu.org/svn/gcc/branches/gcc-5-branch revision 237460 You'll find: gcc-5-20160614.tar.bz2 Complete GCC MD5=3d50f803e9e232ccc6d45eb63d3787dd SHA1=2ec19f982fb49ce93c6602ac84a2b5606ba22a8b Diffs from 5-20160607 are available in the diffs/ subdirectory. When a particular snapshot is ready for public consumption the LATEST-5 link is updated and a message is sent to the gcc list. Please do not use a snapshot before it has been announced that way.