Fix C++ testsuite failures.

Mark Mitchell mark@codesourcery.com
Wed Mar 8 19:18:00 GMT 2006


Gabriel Dos Reis wrote:

>        One reason for this difference is that compiler technology has
>    progressed to the point where the register hint if often more
>    trouble than it is worth.  Another reason is that in C++ variables
>    are often objects of classes with associated operations.  Leaving
>    /register/ as more than a simple hint to the compiler could hinder
>    both portability and optimization.

Yes, C++ relaxed the rules about register variables, but that doesn't
mean that user expectation relaxed along with them.

> | Even the C++ standard obliquely suggests that "register" should put
> | things in a register; [dcl.stc]/3 says "in most implementations [the
> | hint] will be ignored if the address of the object is taken".  That is
> | reason enough to warn; the program has given the compiler a hint which,
> | in most implementations, will be ignored.
> 
> I believe having a compiler switch for that diagnostic makes perfect
> sense (one that we should have)

So few people use register declarations any more -- especially in C++ --
that adding switches for this is way too much buck for too little bang.
 We should just accept the patch to fix the failing tests, adding the
dg-warn directives as suggested by the poster, and move on.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list