| 
     
      
      
      From: Bruno H. <br...@cl...> - 2016-11-10 00:54:43
       
   | 
Hi Sam,
I need to correct your change of
2016-08-28  Sam Steingold  <sd...@gn...>
	avoid the clang -Wgnu-designator warning
	* lispbibl.d (as_object, as_chart): use the new {.one_o=???}
	syntax instead of GNU old-style field designator extension {one_o:???}
	https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Designated-Inits.html
The reason is that it introduces compilation errors when one attempts to use
DEBUG_GCSAFETY with g++ < 4.7.
DEBUG_GCSAFETY requires a C++ compiler and defines OBJECT_STRUCT.
Look at this test program:
================================= foo.cc =================================
typedef unsigned long uintP;
typedef signed long sintP;
typedef struct { uintP one_o; } gcv_object_t;
typedef uintP oint;
typedef sintP soint;
typedef gcv_object_t object;
#define as_oint(expr)  ((expr).one_o)
// Works with any GCC but only with G++ >= 4.7. With clang no warning.
#define as_object(o)  ((object){.one_o=(o)})
// Works with any GCC and any G++. With clang it gives "warning: use of GNU old-style field designator extension"
//#define as_object(o)  ((object){one_o:(o)})
extern gcv_object_t a;
extern oint b;
oint foo () { return as_oint(a); }
gcv_object_t bar () { return as_object(b); }
==========================================================================
With G++ 4.6.4 and older:
$ g++ -c foo.cc
foo.cc: In Funktion »gcv_object_t bar()«:
foo.cc:21:30: Fehler: expected primary-expression before »)« token
foo.cc:21:30: Fehler: expected »)« before »{« token
foo.cc:21:30: Fehler: expected »;« before »)« token
foo.cc:21:30: Fehler: expected primary-expression before »)« token
foo.cc:21:30: Fehler: expected »;« before »)« token
The syntax   .one_o=(o)
appears to be more standard: it is described in Wikipedia [1] and the GCC
documentation [2].
The syntax   one_o:(o)
is only documented in the GCC doc [2] and is marked as "obsolete since GCC 2.5".
But with G++ 4.6.4 and older it's the only available syntax.
Bruno
[1] https://en.wikipedia.org/wiki/C_syntax#Designated_initializers
[2] https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Designated-Inits.html
 | 
| 
     
      
      
      From: Sam S. <sd...@gn...> - 2016-11-10 15:59:42
       
   | 
Hi Bruno,
> * Bruno Haible <oe...@py...> [2016-11-10 01:54:20 +0100]:
>
> I need to correct your change of
>
> 2016-08-28  Sam Steingold  <sd...@gn...>
>
> 	avoid the clang -Wgnu-designator warning
> 	* lispbibl.d (as_object, as_chart): use the new {.one_o=???}
> 	syntax instead of GNU old-style field designator extension {one_o:???}
> 	https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Designated-Inits.html
>
> The reason is that it introduces compilation errors when one attempts to use
> DEBUG_GCSAFETY with g++ < 4.7.
The current GCC version is 6.
Are you sure we need to support any version of GCC older than, say, 5?
(Okay, I am using an AWS server with gcc (GCC) 4.8.3 20140911 (Red Hat
4.8.3-9)).
> With G++ 4.6.4 and older:
> $ g++ -c foo.cc
> foo.cc: In Funktion »gcv_object_t bar()«:
> foo.cc:21:30: Fehler: expected primary-expression before »)« token
> foo.cc:21:30: Fehler: expected »)« before »{« token
> foo.cc:21:30: Fehler: expected »;« before »)« token
> foo.cc:21:30: Fehler: expected primary-expression before »)« token
> foo.cc:21:30: Fehler: expected »;« before »)« token
>
> The syntax   .one_o=(o)
> appears to be more standard: it is described in Wikipedia [1] and the GCC
> documentation [2].
I wonder if the C++ standard has anything to say about it.
> The syntax   one_o:(o)
> is only documented in the GCC doc [2] and is marked as "obsolete since GCC 2.5".
> But with G++ 4.6.4 and older it's the only available syntax.
Am I the only one who finds this ironic? ("obsolete since 2.5, but the
only option for 4.6.4 and older")
> [1] https://en.wikipedia.org/wiki/C_syntax#Designated_initializers
> [2] https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Designated-Inits.html
So what are you going to do?
(obviously, I have no objections to whatever change you want to push)
-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1504
http://steingoldpsychology.com http://www.childpsy.net
http://iris.org.il http://camera.org http://thereligionofpeace.com
In C you can make mistakes, while in C++ you can also inherit them!
 | 
| 
     
      
      
      From: Bruno H. <br...@cl...> - 2016-11-10 16:36:40
       
   | 
Hi Sam,
> > The reason is that it introduces compilation errors when one attempts to use
> > DEBUG_GCSAFETY with g++ < 4.7.
> 
> The current GCC version is 6.
> Are you sure we need to support any version of GCC older than, say, 5?
RHEL 5.11 is supported until March 2017 and ships with G++ 4.1.x.
Ubuntu 12.04 is supported until April 2017 and ships with G++ 4.6.3.
> > The syntax   one_o:(o)
> > is only documented in the GCC doc [2] and is marked as "obsolete since GCC 2.5".
> > But with G++ 4.6.4 and older it's the only available syntax.
> 
> Am I the only one who finds this ironic? ("obsolete since 2.5, but the
> only option for 4.6.4 and older")
No. I find it strange too that they declared something "obsolete" and the
replacement was not available for 19 years.
> So what are you going to do?
> (obviously, I have no objections to whatever change you want to push)
I pushed it already. You should have received the automatic notification mail.
Bruno
 |