bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] freading: declare with attribute "pure"


From: Bruno Haible
Subject: Re: [PATCH] freading: declare with attribute "pure"
Date: Sat, 4 Jan 2014 00:13:33 +0100 (CET)

Hi Jim,

> FYI, without this patch and with very recent gcc, I would see warnings
> like this:
>
> lib/freading.c:29:1: error: function might be candidate for attribute 'pure'\
> [-Werror=suggest-attribute=pure]

The documentation [1] mentions as example of a non-pure function "feof in a
multithreaded environment". freading is similar to feof. But our extended stdio
functions have little chance of being useful in an environment where the same
stream is accessed from different threads. Therefore OK for the change.

But all of the functions
  freadable
  freadahead
  freading
  fwritable
  fwriting
are similar enough that they should be treated the same way. Can you add the
'__pure__' attribute also the other 4 functions as well?

Bruno

[1] http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]