This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Deprecating arithmetic on std::atomic<void*>


On 20/04/17 11:43 +0200, Florian Weimer wrote:
On 04/20/2017 11:25 AM, Jonathan Wakely wrote:

I mean, with -pedantic-errors we already error on void * arighmetics
or function pointer arithmetics.  If std::atomic<void*> would use
the void * arithmetics, it would also reject it.  Or does it use integer
arithmetics instead?

No, it does it on void*, but the __atomic built-ins still perform that
arithmetic even with -pedantic-errors.

sizeof is not defined for the relevant types, either, and already triggers a warning by default:

t.cc:25:58: warning: invalid application of ‘sizeof’ to a void type [-Wpointer-arith]
  _M_type_size(ptrdiff_t __d) const { return __d * sizeof(_PTp); }

That could be easily avoided if we care about supporting arithmetic on
std::atomic<void*>.

I think the actual problem here is the suppression of warnings from system headers.

The atomic built-ins still don't warn even with -Wsystem-headers



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]