Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Require extern modifier for function prototypes in headers.
@ 2012-12-19 11:25     ` Pierre Muller
  2012-12-22 12:54       ` Jan Kratochvil
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2012-12-19 11:25 UTC (permalink / raw)
  To: gdb-patches

  Following the discussion triggered by my latest
RFA/OBVIOUS? email,
  Joel proposed that I added a change to GDB coding styles.

  Here it is.

  Currently you can use "extern" modifier or leave it out.
Apparently it should make no difference for function prototypes,
but I still find it strange to have all functions but one
being declared with "extern", like in ui-file.h header.


  Comments mowt welcome,



Pierre Muller
GDB pascal language maintainer


2012-12-19  Pierre Muller  <muller@sourceware.org>

        * gdbint.texinfo (Function prototypes): Require use of "extern"
        modifier for function prototypes in headers.


Index: gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.344
diff -u -r1.344 gdbint.texinfo
--- gdbint.texinfo      16 Dec 2012 19:00:04 -0000      1.344
+++ gdbint.texinfo      19 Dec 2012 11:19:40 -0000
@@ -5935,7 +5935,8 @@
 function definition.

 All external functions should have a declaration in a header file that
-callers include, except for @code{_initialize_*} functions, which must
+callers include, that declaration should use the @code{extern} modifier.
+The only exception concerns @code{_initialize_*} functions, which must
 be external so that @file{init.c} construction works, but shouldn't be
 visible to random source files.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Require extern modifier for function prototypes in headers.
       [not found] <000001cddddb$7999a0a0$6ccce1e0$%muller@ics-cnrs.unistra.fr>
@ 2012-12-19 16:58 ` Eli Zaretskii
  2012-12-19 21:48   ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2012-12-19 16:58 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

> From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> Date: Wed, 19 Dec 2012 12:24:56 +0100
> 
>  All external functions should have a declaration in a header file that
> -callers include, except for @code{_initialize_*} functions, which must
> +callers include, that declaration should use the @code{extern} modifier.
> +The only exception concerns @code{_initialize_*} functions, which must
>  be external so that @file{init.c} construction works, but shouldn't be
>  visible to random source files.

If all declarations must be external, the _initialize_* case is no
longer special, so the second sentence should go away, IMO.

Otherwise, OK with me.

Thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFC] Require extern modifier for function prototypes in headers.
  2012-12-19 16:58 ` [RFC] Require extern modifier for function prototypes in headers Eli Zaretskii
@ 2012-12-19 21:48   ` Pierre Muller
  2012-12-19 11:25     ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2012-12-19 21:48 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: gdb-patches



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : mercredi 19 décembre 2012 17:58
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFC] Require extern modifier for function prototypes in
> headers.
> 
> > From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> > Date: Wed, 19 Dec 2012 12:24:56 +0100
> >
> >  All external functions should have a declaration in a header file that
> > -callers include, except for @code{_initialize_*} functions, which must
> > +callers include, that declaration should use the @code{extern}
modifier.
> > +The only exception concerns @code{_initialize_*} functions, which must
> >  be external so that @file{init.c} construction works, but shouldn't be
> >  visible to random source files.
> 
> If all declarations must be external, the _initialize_* case is no
> longer special, so the second sentence should go away, IMO.


  I thought that it was still special in the sense that they
are the only non-static functions that are not declared in headers,
but only inside the C source itself.

 
> Otherwise, OK with me.
> 
> Thanks.

Pierre


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFC] Require extern modifier for function prototypes in headers.
  2012-12-19 11:25     ` Pierre Muller
@ 2012-12-22 12:54       ` Jan Kratochvil
  2012-12-22 17:53         ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kratochvil @ 2012-12-22 12:54 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches, 'Eli Zaretskii'

On Wed, 19 Dec 2012 12:24:56 +0100, Pierre Muller wrote:
>   Joel proposed that I added a change to GDB coding styles.

It was me, that we do not put it into Joel's mouth.


On Wed, 19 Dec 2012 22:48:11 +0100, Pierre Muller wrote:
> > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > owner@sourceware.org] De la part de Eli Zaretskii
[...]
> > If all declarations must be external, the _initialize_* case is no
> > longer special, so the second sentence should go away, IMO.
> 
>   I thought that it was still special in the sense that they
> are the only non-static functions that are not declared in headers,
> but only inside the C source itself.

I agree with the technical part said by Pierre here.  So the doc change seems
approved to me that way.


Thanks,
Jan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFC] Require extern modifier for function prototypes in headers.
  2012-12-22 12:54       ` Jan Kratochvil
@ 2012-12-22 17:53         ` Pierre Muller
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2012-12-22 17:53 UTC (permalink / raw)
  To: 'Jan Kratochvil'; +Cc: gdb-patches, 'Eli Zaretskii'



> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Jan Kratochvil
> Envoyé : samedi 22 décembre 2012 13:54
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org; 'Eli Zaretskii'
> Objet : Re: [RFC] Require extern modifier for function prototypes in
> headers.
> 
> On Wed, 19 Dec 2012 12:24:56 +0100, Pierre Muller wrote:
> >   Joel proposed that I added a change to GDB coding styles.
> 
> It was me, that we do not put it into Joel's mouth.

  Whoops, sorry  for the mistake.
 
> On Wed, 19 Dec 2012 22:48:11 +0100, Pierre Muller wrote:
> > > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> > > owner@sourceware.org] De la part de Eli Zaretskii
> [...]
> > > If all declarations must be external, the _initialize_* case is no
> > > longer special, so the second sentence should go away, IMO.
> >
> >   I thought that it was still special in the sense that they
> > are the only non-static functions that are not declared in headers,
> > but only inside the C source itself.
> 
> I agree with the technical part said by Pierre here.  So the doc change
> seems
> approved to me that way.
Thanks,

Patch applied in
http://sourceware.org/ml/gdb-cvs/2012-12/msg00174.html



Pierre Muller


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-22 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <000001cddddb$7999a0a0$6ccce1e0$%muller@ics-cnrs.unistra.fr>
2012-12-19 16:58 ` [RFC] Require extern modifier for function prototypes in headers Eli Zaretskii
2012-12-19 21:48   ` Pierre Muller
2012-12-19 11:25     ` Pierre Muller
2012-12-22 12:54       ` Jan Kratochvil
2012-12-22 17:53         ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox