* Make declaration of wide_int_storage match its definition
@ 2014-07-05 18:43 Gerald Pfeifer
2014-07-05 19:03 ` pinskia
2014-07-07 10:51 ` Mike Stump
0 siblings, 2 replies; 6+ messages in thread
From: Gerald Pfeifer @ 2014-07-05 18:43 UTC (permalink / raw)
To: gcc-patches; +Cc: Kenneth Zadeck, Mike Stump, Richard Sandiford
Farther below in wide-int.h, we define wide_int_storage as a class:
class GTY(()) wide_int_storage
{
private:
HOST_WIDE_INT val[WIDE_INT_MAX_ELTS];
unsigned int len;
unsigned int precision;
:
The patch below, which I applied as obvious after a full bootstrap on
i386-unknown-freebsd10.0, makes the declaration match the definition.
Gerald
2014-07-05 Gerald Pfeifer <gerald@pfeifer.com>
* wide-int.h (wide_int_storage): Change declaration from struct
to class.
Index: wide-int.h
===================================================================
--- wide-int.h (revision 212304)
+++ wide-int.h (working copy)
@@ -284,7 +284,7 @@
template <typename T> struct generic_wide_int;
template <int N> struct fixed_wide_int_storage;
-struct wide_int_storage;
+class wide_int_storage;
/* An N-bit integer. Until we can use typedef templates, use this instead. */
#define FIXED_WIDE_INT(N) \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make declaration of wide_int_storage match its definition
2014-07-05 18:43 Make declaration of wide_int_storage match its definition Gerald Pfeifer
@ 2014-07-05 19:03 ` pinskia
2014-07-05 19:25 ` Gerald Pfeifer
2014-07-07 10:51 ` Mike Stump
1 sibling, 1 reply; 6+ messages in thread
From: pinskia @ 2014-07-05 19:03 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: gcc-patches, Kenneth Zadeck, Mike Stump, Richard Sandiford
> On Jul 5, 2014, at 11:42 AM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
>
> Farther below in wide-int.h, we define wide_int_storage as a class:
>
> class GTY(()) wide_int_storage
> {
> private:
> HOST_WIDE_INT val[WIDE_INT_MAX_ELTS];
> unsigned int len;
> unsigned int precision;
> :
>
> The patch below, which I applied as obvious after a full bootstrap on
> i386-unknown-freebsd10.0, makes the declaration match the definition.
This patch is fine but c++ allows class and struct be used interchangeable. If there is a compilers which does not it is broken and should be report to them. Yes that means clang is broken.
Thanks,
Andrew
>
> Gerald
>
> 2014-07-05 Gerald Pfeifer <gerald@pfeifer.com>
>
> * wide-int.h (wide_int_storage): Change declaration from struct
> to class.
>
> Index: wide-int.h
> ===================================================================
> --- wide-int.h (revision 212304)
> +++ wide-int.h (working copy)
> @@ -284,7 +284,7 @@
>
> template <typename T> struct generic_wide_int;
> template <int N> struct fixed_wide_int_storage;
> -struct wide_int_storage;
> +class wide_int_storage;
>
> /* An N-bit integer. Until we can use typedef templates, use this instead. */
> #define FIXED_WIDE_INT(N) \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make declaration of wide_int_storage match its definition
2014-07-05 19:03 ` pinskia
@ 2014-07-05 19:25 ` Gerald Pfeifer
2014-07-05 19:29 ` Jakub Jelinek
0 siblings, 1 reply; 6+ messages in thread
From: Gerald Pfeifer @ 2014-07-05 19:25 UTC (permalink / raw)
To: Andrew Pinski; +Cc: gcc-patches, Kenneth Zadeck, Mike Stump, Richard Sandiford
On Sat, 5 Jul 2014, pinskia@gmail.com wrote:
> This patch is fine but c++ allows class and struct be used
> interchangeable. If there is a compilers which does not it is broken
> and should be report to them. Yes that means clang is broken.
Clang does allow for it (it actually is the stage 1 compiler on
FreeBSD 10, the platform I used for my tests); it just warns about
it. About 400 times.
That was just one, factor, though. Declarations being consistent
with definitions stroke me as A Good Thing[tm] per se. :-)
Gerald
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make declaration of wide_int_storage match its definition
2014-07-05 19:25 ` Gerald Pfeifer
@ 2014-07-05 19:29 ` Jakub Jelinek
2014-07-06 19:39 ` Trevor Saunders
0 siblings, 1 reply; 6+ messages in thread
From: Jakub Jelinek @ 2014-07-05 19:29 UTC (permalink / raw)
To: Gerald Pfeifer
Cc: Andrew Pinski, gcc-patches, Kenneth Zadeck, Mike Stump,
Richard Sandiford
On Sat, Jul 05, 2014 at 09:25:50PM +0200, Gerald Pfeifer wrote:
> On Sat, 5 Jul 2014, pinskia@gmail.com wrote:
> > This patch is fine but c++ allows class and struct be used
> > interchangeable. If there is a compilers which does not it is broken
> > and should be report to them. Yes that means clang is broken.
>
> Clang does allow for it (it actually is the stage 1 compiler on
> FreeBSD 10, the platform I used for my tests); it just warns about
> it. About 400 times.
That doesn't change anything that the warning is very much broken.
In C++ struct is simply a class with default public:, class with a default
private:, when you are just forward declaring it, whether it defaults to
public: or private: doesn't matter at all, therefore the warning just
enforces some weirdo clang coding style.
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make declaration of wide_int_storage match its definition
2014-07-05 19:29 ` Jakub Jelinek
@ 2014-07-06 19:39 ` Trevor Saunders
0 siblings, 0 replies; 6+ messages in thread
From: Trevor Saunders @ 2014-07-06 19:39 UTC (permalink / raw)
To: Jakub Jelinek
Cc: Gerald Pfeifer, Andrew Pinski, gcc-patches, Kenneth Zadeck,
Mike Stump, Richard Sandiford
On Sat, Jul 05, 2014 at 09:29:31PM +0200, Jakub Jelinek wrote:
> On Sat, Jul 05, 2014 at 09:25:50PM +0200, Gerald Pfeifer wrote:
> > On Sat, 5 Jul 2014, pinskia@gmail.com wrote:
> > > This patch is fine but c++ allows class and struct be used
> > > interchangeable. If there is a compilers which does not it is broken
> > > and should be report to them. Yes that means clang is broken.
> >
> > Clang does allow for it (it actually is the stage 1 compiler on
> > FreeBSD 10, the platform I used for my tests); it just warns about
> > it. About 400 times.
>
> That doesn't change anything that the warning is very much broken.
> In C++ struct is simply a class with default public:, class with a default
> private:, when you are just forward declaring it, whether it defaults to
> public: or private: doesn't matter at all, therefore the warning just
> enforces some weirdo clang coding style.
I thought the warning was to help people who care about MSVC and its
utterly broken mangling, but I also agree its a pretty silly warning
that I wouldn't mind turning off.
Trev
>
> Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Make declaration of wide_int_storage match its definition
2014-07-05 18:43 Make declaration of wide_int_storage match its definition Gerald Pfeifer
2014-07-05 19:03 ` pinskia
@ 2014-07-07 10:51 ` Mike Stump
1 sibling, 0 replies; 6+ messages in thread
From: Mike Stump @ 2014-07-07 10:51 UTC (permalink / raw)
To: Gerald Pfeifer; +Cc: gcc-patches, Kenneth Zadeck, Richard Sandiford
On Jul 5, 2014, at 11:42 AM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Farther below in wide-int.h, we define wide_int_storage as a class:
>
> class GTY(()) wide_int_storage
> {
> private:
> HOST_WIDE_INT val[WIDE_INT_MAX_ELTS];
> unsigned int len;
> unsigned int precision;
> :
>
> The patch below, which I applied as obvious
Thanks. We did want them to match.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-07 10:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-05 18:43 Make declaration of wide_int_storage match its definition Gerald Pfeifer
2014-07-05 19:03 ` pinskia
2014-07-05 19:25 ` Gerald Pfeifer
2014-07-05 19:29 ` Jakub Jelinek
2014-07-06 19:39 ` Trevor Saunders
2014-07-07 10:51 ` Mike Stump
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).