Bug 6714 - WindRes 2.18 can't concatenate literal strings anymore?
Summary: WindRes 2.18 can't concatenate literal strings anymore?
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.18
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-01 12:46 UTC by Carl Colijn
Modified: 2009-07-01 15:52 UTC (History)
4 users (show)

See Also:
Host:
Target: Windows XP SP3
Build:
Last reconfirmed:


Attachments
Join quoted strings separated by whitespace. (497 bytes, patch)
2009-07-01 15:48 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carl Colijn 2008-07-01 12:46:55 UTC
I'm using MingW (including BinUtils' WindRes).  Since I installed a MingW 
version including BinUtils 2.18, my resource files that use literal string 
concatenation do not work anymore.  I previously used BinUtils version 
2.17.50.  I have checked all 2.18.50 builds (2007-11-23, 2008-01-09 and 2008-01-
09-2), but they all give the same error.

The error I get is:
windres.exe: C:\\Source\\TIMETR~1.RC:137: syntax error
windres.exe: preprocessing failed.

The source for that line is:
    LTEXT           "Value: " VALUE_AS_TXT, IDC_REPORT_LIC_LBL, 7, 238, 100, 
16, NOT WS_VISIBLE
where VALUE_AS_TXT is #defined in an included header file like:
#define VALUE_AS_TXT "15"

But then the following simple test case also fails in the same way:
    PUSHBUTTON      "..." "15", IDC_REPORT_BROWSE, 278, 220, 18, 12
Comment 1 Brian Dessent 2008-07-01 17:12:30 UTC
Subject: Re:  New: WindRes 2.18 can't concatenate 
 literalstrings anymore?

c dot colijn at twologs dot com wrote:

> windres.exe: C:\\Source\\TIMETR~1.RC:137: syntax error
> windres.exe: preprocessing failed.

This was fixed some time ago in CVS, please try a more recent version.
Comment 2 craigwharding 2009-02-07 00:35:10 UTC
(In reply to comment #1)
> Subject: Re:  New: WindRes 2.18 can't concatenate 
>  literalstrings anymore?
> 
> c dot colijn at twologs dot com wrote:
> 
> > windres.exe: C:\\Source\\TIMETR~1.RC:137: syntax error
> > windres.exe: preprocessing failed.
> 
> This was fixed some time ago in CVS, please try a more recent version.
> 

I was searching for my error with windres and found this
(http://www.dronecode.org.uk/daybook/2008/08/pidgin-monotone-crosscompile-for-win32.html),.
The fourth point describes my problem. That link led me here. 

I'm using 2.19 and I still get the same error of :

/opt/mingw32/bin/i586-pc-mingw32-windres: icon file `pixmaps/' does not contain
icon data

Is there a temp fix I can apply to get this working..?
Comment 3 Nick Clifton 2009-02-11 14:38:34 UTC
Subject: Re:  WindRes 2.18 can't concatenate literal strings
 anymore?

Hi Craig,

> I'm using 2.19 and I still get the same error of :
> 
> /opt/mingw32/bin/i586-pc-mingw32-windres: icon file `pixmaps/' does not contain
> icon data
> 
> Is there a temp fix I can apply to get this working..?

1. Create a patch to fix windres so that it will concatenate string 
literals.

or:

2. Submit a bug report to http://sourceware.org/bugzilla/ describing the 
problem and including a small test case to reproduce the problem.

or:

3. Edit your resource file and perform the string literal concatenation 
yourself.

or:

4. Create a tool in your favourite programming language to pre-process 
the resources files for you.

Cheers
   Nick

Comment 4 Nick Clifton 2009-02-11 14:40:39 UTC
Doh! Please ignore suggestion 2.  I had completely blanked on this already being
in bugzilla.
Comment 5 Nick Clifton 2009-02-11 14:53:11 UTC
Hi Craig,

  I think that you are going to have to post another test case to demonstrate
the problem that you are having.  I tried the following:

  % cat fred.inc
  #define VALUE_AS_TXT "15"

  % cat fred.rc
  #include "fred.inc"

  101 DIALOG DISCARDABLE  0, 0, 186, 95
  BEGIN
     LTEXT           "Value: " VALUE_AS_TXT, -1, 7, 238, 100,  16
     LTEXT           "Value: " "16",         -1, 7, 238, 100,  16
     LTEXT           "Value: 17",            -1, 7, 238, 100,  16
  END

And got this result:

  % windres fred.rc
  LANGUAGE 9, 1

  101 DIALOG MOVEABLE PURE DISCARDABLE 0, 0, 186, 95
  STYLE 0x80880000
  BEGIN
    LTEXT "Value: 15", -1, 7, 238, 100, 16, 0x50020000
    LTEXT "Value: 16", -1, 7, 238, 100, 16, 0x50020000
    LTEXT "Value: 17", -1, 7, 238, 100, 16, 0x50020000
  END


So string literal concatenation is working.

Cheers
  Nick
Comment 6 Stu Tomlinson 2009-05-13 19:34:28 UTC
Here's a test case:

$ cat stringconcattest.rc 
#define PIXMAPSDIR "pixmaps/"

TRAY_ICON_TEST  ICON PIXMAPSDIR "testicon.ico"

$ ls -l pixmaps/testicon.ico 
-rw-rw-r--. 1 stu stu 318 2009-05-13 20:30 pixmaps/testicon.ico

$ i686-pc-mingw32-windres -i stringconcattest.rc -o stringconcattest.o
i686-pc-mingw32-windres: icon file `pixmaps/' does not contain icon data

$ i686-pc-mingw32-windres --version
GNU windres (GNU Binutils) 2.19.1
Comment 7 Nick Clifton 2009-07-01 15:48:21 UTC
Created attachment 4033 [details]
Join quoted strings separated by whitespace.
Comment 8 Nick Clifton 2009-07-01 15:52:11 UTC
Hi Carl,

  Thank you for submitting a test case, and sorry for taking so long to reply to
your posting.

  You are correct, windres was not concatenating quoted strings as it ought to
have been doing.  I am going to apply the uploaded patch to fix this problems. 
it works with the test case you provided but if you find any more circumstances
under which concatenation does not work, please reopen this PR and submit a new
test case.

Cheers
  Nick

binutils/ChangeLog
	PR 6714
	* rclex.c (handle_quotes): Do not complain about whitespace
	separating quoted strings.
	(rclex_string): Ignore whitespace when looking for a new opening
	quote following a closing quote.
Comment 9 cvs-commit@gcc.gnu.org 2009-07-01 15:52:39 UTC
Subject: Bug 6714

CVSROOT:	/cvs/src
Module name:	src
Changes by:	nickc@sourceware.org	2009-07-01 15:52:28

Modified files:
	binutils       : ChangeLog rclex.c 

Log message:
	PR 6714
	* rclex.c (handle_quotes): Do not complain about whitespace
	separating quoted strings.
	(rclex_string): Ignore whitespace when looking for a new opening
	quote following a closing quote.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1490&r2=1.1491
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/rclex.c.diff?cvsroot=src&r1=1.6&r2=1.7