This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

[patch] optional semicolon in version script


Hi !

After I've seen more than person making the "mistake" to write a ld
version script like

  {
    local:
    extern "C" {
      foo;
      bar;    ### semicolon gives a parse error
    };
  };

I suggest to optionally a semicolon at this position. It's more consistent
(and C-like) to do this as the semicolon before the closing brace is
required without the extern group:

 {
    local:
      foo;
      bar;    ### semicolon required
  };

Please consider following patch for inclusion in a future release.

Thanks,

Harri.

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/ld/ChangeLog,v
retrieving revision 1.827
diff -u -3 -p -r1.827 ChangeLog
--- ChangeLog   30 Dec 2002 19:25:04 -0000      1.827
+++ ChangeLog   31 Dec 2002 19:47:38 -0000
@@ -1,3 +1,8 @@
+2002-12-31  Harri Porten  <porten@kde.org>
+
+       * ldgram.y (vers_defns): allow trailing semicolon in extern
+       "<lang>" { ... } expression.
+
 2002-12-24    Dmitry Diky <diwil@mail.ru>
 
        * Makefile.am: Add msp430 target.
Index: ldgram.y
===================================================================
RCS file: /cvs/src/src/ld/ldgram.y,v
retrieving revision 1.23
diff -u -3 -p -r1.23 ldgram.y
--- ldgram.y    30 Nov 2002 08:39:45 -0000      1.23
+++ ldgram.y    31 Dec 2002 19:47:38 -0000
@@ -1135,12 +1135,15 @@ vers_defns:
                          $<name>$ = ldgram_vers_current_lang;
                          ldgram_vers_current_lang = $2;
                        }
-               vers_defns '}'
+               vers_defns opt_semicolon '}'
                        {
                          $$ = $5;
                          ldgram_vers_current_lang = $<name>4;
                        }
        ;
+
+opt_semicolon:
+               ';'     |       ;
 
 %%
 void



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