summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2007-05-24 11:01:07 +0000
committerNick Clifton <nickc@redhat.com>2007-05-24 11:01:07 +0000
commitf1779355a52f54094740dc94239bbe34c3ae042a (patch)
tree6217ea3fd9353d2482fccb04f89a931097015c63
parent746dcfd6a0c3e31c85454a1be271d513e46459f6 (diff)
downloadbinutils-redhat-f1779355a52f54094740dc94239bbe34c3ae042a.tar.gz
* rcparse.y: Join strings for elements having no side-effects in "rc"-grammar.
* testsuite/binutils-all/windres/version_cat.rc: New. * testsuite/binutils-all/windres/version_cat.rsd: New.
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/rcparse.y62
-rw-r--r--binutils/testsuite/ChangeLog5
-rw-r--r--binutils/testsuite/binutils-all/windres/version_cat.rc33
-rw-r--r--binutils/testsuite/binutils-all/windres/version_cat.rsd55
5 files changed, 139 insertions, 21 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 96d391aeea..fd41c27f34 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-24 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * rcparse.y: Join strings for elements having no side-effects in
+ "rc"-grammar.
+
2007-05-23 Kai Tietz <Kai.Tietz@onevision.com>
* rclex.c: New file replacing rclex.l.
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index 989fac8d04..ac72ee7777 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -159,7 +159,7 @@ static const rc_res_id res_null_text = { 1, {{0, &null_unichar}}};
%type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
%type <is> acc_options acc_option menuitem_flags menuitem_flag
%type <s> file_name
-%type <uni> res_unicode_string resname
+%type <uni> res_unicode_string resname res_unicode_string_concat
%type <ss> sizedstring
%type <suni> sizedunistring
%type <i> sizednumexpr sizedposnumexpr
@@ -442,7 +442,7 @@ exstyle:
styles:
/* empty */
- | styles CAPTION res_unicode_string
+ | styles CAPTION res_unicode_string_concat
{
dialog.style |= WS_CAPTION;
style |= WS_CAPTION;
@@ -461,11 +461,11 @@ styles:
{
dialog.exstyle = $3;
}
- | styles CLASS res_unicode_string
+ | styles CLASS res_unicode_string_concat
{
res_unistring_to_id (& dialog.class, $3);
}
- | styles FONT numexpr ',' res_unicode_string
+ | styles FONT numexpr ',' res_unicode_string_concat
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
@@ -478,7 +478,7 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' res_unicode_string cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
@@ -493,7 +493,7 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' res_unicode_string cnumexpr cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
@@ -508,7 +508,7 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' res_unicode_string cnumexpr cnumexpr cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr cnumexpr cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
@@ -1032,7 +1032,7 @@ menuitems:
;
menuitem:
- MENUITEM res_unicode_string cnumexpr menuitem_flags
+ MENUITEM res_unicode_string_concat cnumexpr menuitem_flags
{
$$ = define_menuitem ($2, $3, $4, 0, 0, NULL);
}
@@ -1040,7 +1040,7 @@ menuitem:
{
$$ = define_menuitem (NULL, 0, 0, 0, 0, NULL);
}
- | POPUP res_unicode_string menuitem_flags BEG menuitems END
+ | POPUP res_unicode_string_concat menuitem_flags BEG menuitems END
{
$$ = define_menuitem ($2, 0, $3, 0, 0, $5);
}
@@ -1122,15 +1122,15 @@ menuexitems:
;
menuexitem:
- MENUITEM res_unicode_string
+ MENUITEM res_unicode_string_concat
{
$$ = define_menuitem ($2, 0, 0, 0, 0, NULL);
}
- | MENUITEM res_unicode_string cnumexpr
+ | MENUITEM res_unicode_string_concat cnumexpr
{
$$ = define_menuitem ($2, $3, 0, 0, 0, NULL);
}
- | MENUITEM res_unicode_string cnumexpr cnumexpr optcnumexpr
+ | MENUITEM res_unicode_string_concat cnumexpr cnumexpr optcnumexpr
{
$$ = define_menuitem ($2, $3, $4, $5, 0, NULL);
}
@@ -1138,19 +1138,19 @@ menuexitem:
{
$$ = define_menuitem (NULL, 0, 0, 0, 0, NULL);
}
- | POPUP res_unicode_string BEG menuexitems END
+ | POPUP res_unicode_string_concat BEG menuexitems END
{
$$ = define_menuitem ($2, 0, 0, 0, 0, $4);
}
- | POPUP res_unicode_string cnumexpr BEG menuexitems END
+ | POPUP res_unicode_string_concat cnumexpr BEG menuexitems END
{
$$ = define_menuitem ($2, $3, 0, 0, 0, $5);
}
- | POPUP res_unicode_string cnumexpr cnumexpr BEG menuexitems END
+ | POPUP res_unicode_string_concat cnumexpr cnumexpr BEG menuexitems END
{
$$ = define_menuitem ($2, $3, $4, 0, 0, $6);
}
- | POPUP res_unicode_string cnumexpr cnumexpr cnumexpr optcnumexpr
+ | POPUP res_unicode_string_concat cnumexpr cnumexpr cnumexpr optcnumexpr
BEG menuexitems END
{
$$ = define_menuitem ($2, $3, $4, $5, $6, $8);
@@ -1259,14 +1259,14 @@ stringtable:
string_data:
/* empty */
- | string_data numexpr res_unicode_string
+ | string_data numexpr res_unicode_string_concat
{
define_stringtable (&sub_res_info, $2, $3);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
}
- | string_data numexpr ',' res_unicode_string
+ | string_data numexpr ',' res_unicode_string_concat
{
define_stringtable (&sub_res_info, $2, $4);
if (yychar != YYEMPTY)
@@ -1469,7 +1469,7 @@ verblocks:
{
$$ = append_ver_stringfileinfo ($1, $4, $6);
}
- | verblocks BLOCKVARFILEINFO BEG VALUE res_unicode_string vertrans END
+ | verblocks BLOCKVARFILEINFO BEG VALUE res_unicode_string_concat vertrans END
{
$$ = append_ver_varfileinfo ($1, $5, $6);
}
@@ -1480,7 +1480,7 @@ vervals:
{
$$ = NULL;
}
- | vervals VALUE res_unicode_string ',' res_unicode_string
+ | vervals VALUE res_unicode_string_concat ',' res_unicode_string_concat
{
$$ = append_verval ($1, $3, $5);
}
@@ -1505,7 +1505,6 @@ id:
$$.named = 0;
$$.u.id = $1;
}
-
| resname
{
res_unistring_to_id (&$$, $1);
@@ -1666,6 +1665,27 @@ file_name:
}
;
+/* Concat string */
+res_unicode_string_concat:
+ res_unicode_string
+ {
+ $$ = $1;
+ }
+ |
+ res_unicode_string_concat res_unicode_string
+ {
+ rc_uint_type l1 = unichar_len ($1);
+ rc_uint_type l2 = unichar_len ($2);
+ unichar *h = (unichar *) res_alloc ((l1 + l2 + 1) * sizeof (unichar));
+ if (l1 != 0)
+ memcpy (h, $1, l1 * sizeof (unichar));
+ if (l2 != 0)
+ memcpy (h + l1, $2, l2 * sizeof (unichar));
+ h[l1 + l2] = 0;
+ $$ = h;
+ }
+ ;
+
res_unicode_string:
QUOTEDUNISTRING
{
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 265dcaacf7..cd4a041cce 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-24 Kai Tietz <Kai.Tietz@onevision.com>
+
+ * binutils-all/windres/version_cat.rc: New.
+ * binutils-all/windres/version_cat.rsd: New.
+
2007-05-23 Kai Tietz <Kai.Tietz@onevision.com>
* binutils-all/windres/html.rc: New.
diff --git a/binutils/testsuite/binutils-all/windres/version_cat.rc b/binutils/testsuite/binutils-all/windres/version_cat.rc
new file mode 100644
index 0000000000..5b70eada1e
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version_cat.rc
@@ -0,0 +1,33 @@
+//#xfail x86_64-*-mingw*
+#include "windows.h"
+
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+ FILEFLAGS 0x0L
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040704e4"
+ BEGIN
+ VALUE L"Company" "Name", L"binutil\x0073"
+ VALUE "File" "Description", L"RC " L"compiler."
+ VALUE "File" "Version", "1.0.0.1"
+ VALUE "Internal" "Name", "windres" L".exe"
+ VALUE "Legal" "Copyright", "(c) FSF." " All rights are reserved."
+ VALUE "Original" "Filename", L"windres" ".exe"
+ VALUE "Product" "Name", "windows resource " "compiler"
+ VALUE "Product" "Version", "1.0.0.1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x407, 1252
+ END
+END
diff --git a/binutils/testsuite/binutils-all/windres/version_cat.rsd b/binutils/testsuite/binutils-all/windres/version_cat.rsd
new file mode 100644
index 0000000000..85dd5d3528
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/version_cat.rsd
@@ -0,0 +1,55 @@
+
+version.res: file format binary
+
+Contents of section .data:
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 ec020000 20000000 ffff1000 ffff0100 .... ...........
+ 0030 00000000 00000704 00000000 00000000 ................
+ 0040 ec023400 00005600 53005f00 56004500 ..4...V.S._.V.E.
+ 0050 52005300 49004f00 4e005f00 49004e00 R.S.I.O.N._.I.N.
+ 0060 46004f00 00000000 bd04effe 00000100 F.O.............
+ 0070 00000100 01000000 00000100 01000000 ................
+ 0080 3f000000 00000000 04000000 01000000 ?...............
+ 0090 00000000 00000000 00000000 4c020000 ............L...
+ 00a0 00005300 74007200 69006e00 67004600 ..S.t.r.i.n.g.F.
+ 00b0 69006c00 65004900 6e006600 6f000000 i.l.e.I.n.f.o...
+ 00c0 28020000 00003000 34003000 37003000 (.....0.4.0.7.0.
+ 00d0 34006500 34000000 32000900 01004300 4.e.4...2.....C.
+ 00e0 6f006d00 70006100 6e007900 4e006100 o.m.p.a.n.y.N.a.
+ 00f0 6d006500 00000000 62006900 6e007500 m.e.....b.i.n.u.
+ 0100 74006900 6c007300 00000000 42000d00 t.i.l.s.....B...
+ 0110 01004600 69006c00 65004400 65007300 ..F.i.l.e.D.e.s.
+ 0120 63007200 69007000 74006900 6f006e00 c.r.i.p.t.i.o.n.
+ 0130 00000000 52004300 20006300 6f006d00 ....R.C. .c.o.m.
+ 0140 70006900 6c006500 72002e00 00000000 p.i.l.e.r.......
+ 0150 30000800 01004600 69006c00 65005600 0.....F.i.l.e.V.
+ 0160 65007200 73006900 6f006e00 00000000 e.r.s.i.o.n.....
+ 0170 31002e00 30002e00 30002e00 31000000 1...0...0...1...
+ 0180 38000c00 01004900 6e007400 65007200 8.....I.n.t.e.r.
+ 0190 6e006100 6c004e00 61006d00 65000000 n.a.l.N.a.m.e...
+ 01a0 77006900 6e006400 72006500 73002e00 w.i.n.d.r.e.s...
+ 01b0 65007800 65000000 68002200 01004c00 e.x.e...h."...L.
+ 01c0 65006700 61006c00 43006f00 70007900 e.g.a.l.C.o.p.y.
+ 01d0 72006900 67006800 74000000 28006300 r.i.g.h.t...(.c.
+ 01e0 29002000 46005300 46002e00 20004100 ). .F.S.F... .A.
+ 01f0 6c006c00 20007200 69006700 68007400 l.l. .r.i.g.h.t.
+ 0200 73002000 61007200 65002000 72006500 s. .a.r.e. .r.e.
+ 0210 73006500 72007600 65006400 2e000000 s.e.r.v.e.d.....
+ 0220 40000c00 01004f00 72006900 67006900 @.....O.r.i.g.i.
+ 0230 6e006100 6c004600 69006c00 65006e00 n.a.l.F.i.l.e.n.
+ 0240 61006d00 65000000 77006900 6e006400 a.m.e...w.i.n.d.
+ 0250 72006500 73002e00 65007800 65000000 r.e.s...e.x.e...
+ 0260 54001a00 01005000 72006f00 64007500 T.....P.r.o.d.u.
+ 0270 63007400 4e006100 6d006500 00000000 c.t.N.a.m.e.....
+ 0280 77006900 6e006400 6f007700 73002000 w.i.n.d.o.w.s. .
+ 0290 72006500 73006f00 75007200 63006500 r.e.s.o.u.r.c.e.
+ 02a0 20006300 6f006d00 70006900 6c006500 .c.o.m.p.i.l.e.
+ 02b0 72000000 34000800 01005000 72006f00 r...4.....P.r.o.
+ 02c0 64007500 63007400 56006500 72007300 d.u.c.t.V.e.r.s.
+ 02d0 69006f00 6e000000 31002e00 30002e00 i.o.n...1...0...
+ 02e0 30002e00 31000000 44000000 00005600 0...1...D.....V.
+ 02f0 61007200 46006900 6c006500 49006e00 a.r.F.i.l.e.I.n.
+ 0300 66006f00 00000000 24000400 00005400 f.o.....$.....T.
+ 0310 72006100 6e007300 6c006100 74006900 r.a.n.s.l.a.t.i.
+ 0320 6f006e00 00000000 0704e404 o.n.........