linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* parse error before `{', stray '\' in program
@ 2003-04-10  9:23 Graf Alex
  2003-04-10  9:48 ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Graf Alex @ 2003-04-10  9:23 UTC (permalink / raw)
  To: linuxppc-embedded


Hello,

If I have some defines which have '\' inside ...

#define BIND_DESC_ALM \
{ \
	CAlmSourceProp::IdxBindingGrp; \
}

my cross compiler produce following output:

ppc_8xx-gcc -fPIC -DPIC -D_DEBUG -Wall -ansi -g3 -O0
-I/home/projects/Nscu/_Inc -I/home/projects/Nscu/_Inc_PC -c -o main.o
main.cpp
main.cpp:15: parse error before `{'
main.cpp:15: stray '\' in program
main.cpp:16: stray '\' in program

I have have SuSE 8.1 and the cross compiler (ppc_8xx-gcc) has version
2.95.4.

The troubles are coming from the dos <cr><lf> at line end. With gcc 3.2
(from host) I don't have this problems.
I don't want to remove the <cr>s (dos2unix), because these files have to be
used on Windows too.

Any suggestions? Unfortunately there is no ppc_8xx-gcc with version 3.2 out.
Or is it?

Alex


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
  2003-04-10  9:23 Graf Alex
@ 2003-04-10  9:48 ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2003-04-10  9:48 UTC (permalink / raw)
  To: Graf Alex; +Cc: linuxppc-embedded


In message <791B3205DB661A42B4BFE5464A7D1D02010E44F3@chzugexch02.zug.ch.abatos.com> you wrote:
>
> If I have some defines which have '\' inside ...
>
> #define BIND_DESC_ALM \
> { \
> 	CAlmSourceProp::IdxBindingGrp; \
> }
>
> my cross compiler produce following output:
>
> ppc_8xx-gcc -fPIC -DPIC -D_DEBUG -Wall -ansi -g3 -O0
> -I/home/projects/Nscu/_Inc -I/home/projects/Nscu/_Inc_PC -c -o main.o
> main.cpp
> main.cpp:15: parse error before `{'
> main.cpp:15: stray '\' in program
> main.cpp:16: stray '\' in program

This is usually caused by illegal file formats.

> The troubles are coming from the dos <cr><lf> at line end. With gcc 3.2
> (from host) I don't have this problems.

Use Unix file formats (plain '\n' line termination).



Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Brain off-line, please wait.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
       [not found] <791B3205DB661A42B4BFE5464A7D1D02010E44F3@chzugexch02.zug.c h.abatos.com>
@ 2003-04-10 16:47 ` Eugene Surovegin
  0 siblings, 0 replies; 7+ messages in thread
From: Eugene Surovegin @ 2003-04-10 16:47 UTC (permalink / raw)
  To: Graf Alex; +Cc: linuxppc-embedded


At 02:23 AM 4/10/2003, you wrote:

>The troubles are coming from the dos <cr><lf> at line end. With gcc 3.2
>(from host) I don't have this problems.
>I don't want to remove the <cr>s (dos2unix), because these files have to be
>used on Windows too.

There is an old patch (dated 1999) for preprocessor which solves this problem.
Search the net or use the distribution which has this patch applied e.g. MVL.

Eugene


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
       [not found] <3E96684D.7000601@imc-berlin.de>
@ 2003-04-11  7:24 ` Wolfgang Denk
  2003-04-11 12:59   ` Ron Flory
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2003-04-11  7:24 UTC (permalink / raw)
  To: Steven Scholz; +Cc: linuxppc-embedded


In message <3E96684D.7000601@imc-berlin.de> you wrote:
>
> Good you please post the URL to the list if you find one!
> I am facing this problem from time to time ...
>
> Does anyone know if the ppc_8xx-gcc 2.95.4 from DENX ELDK has this
> patch applied?

No, it has not, and will not.

I see no sense in a modification that supports violations  of  the  C
standard.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Work 8 hours, sleep 8 hours; but not the same 8 hours.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
  2003-04-11  7:24 ` parse error before `{', stray '\' in program Wolfgang Denk
@ 2003-04-11 12:59   ` Ron Flory
  0 siblings, 0 replies; 7+ messages in thread
From: Ron Flory @ 2003-04-11 12:59 UTC (permalink / raw)
  To: Steven Scholz, linuxppc-embedded


Wolfgang Denk wrote:
> In message <3E96684D.7000601@imc-berlin.de> you wrote:
>
>>Good you please post the URL to the list if you find one!
>>I am facing this problem from time to time ...
>>
>>Does anyone know if the ppc_8xx-gcc 2.95.4 from DENX ELDK has this
>>patch applied?
>
>
> No, it has not, and will not.
>
> I see no sense in a modification that supports violations  of  the  C
> standard.

  especially when its so easy to cleanup text files by piping them
through 'tr':

    cat "$src_file" | tr -d \\015 > "$tmp_file"
    mv -f $tmp_file $src_file

  which removes those funky MsDos carriage returns.

(depending on your shell, you may be able to skip the tmp_file above)

  Just write a small shell-script that iterates through your source
files, applying this filter.


  Like you, I also develop on several platforms.  I find it convenient
to add a new 'fix' target to the makefiles, then run the above filter
on all source and header files in the project.

   <import file from MsDos/windoze>
   make fix           # with implied 'make clean'
   make

  works great, on lots and lots of projects...

ron


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
       [not found] <5.1.0.14.2.20030411103728.03024f68@mail.ebshome.net>
@ 2003-04-11 19:04 ` Eugene Surovegin
  2003-04-11 20:17   ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Eugene Surovegin @ 2003-04-11 19:04 UTC (permalink / raw)
  To: Ron Flory; +Cc: Wolfgang Denk, linuxppc-embedded


At 10:37 AM 4/11/2003, Ron Flory wrote:

>Wolfgang Denk wrote:
>>In message <3E96684D.7000601@imc-berlin.de> you wrote:
>>
>>>Does anyone know if the ppc_8xx-gcc 2.95.4 from DENX ELDK has this
>>>patch applied?
>>
>>
>>No, it has not, and will not.
>>
>>I see no sense in a modification that supports violations  of  the  C
>>standard.


Well, it doesn't violate any existing C/C++ standard:

This is excerpt from ISO/IEC 9899 (p. 9):

   5.1.1.2 Translation phases

     1 The precedence among the syntax rules of translation is specified
       by the following phases

         1. Physical source file multibyte characters are mapped,
            in an implementation-defined manner, to the source character set
            (introducing new-line characters for end-of-line indicators)
             if necessary.
             ....

         2. Each instance of a backslash character (\) immediately
            followed by a new-line character is deleted, splicing physical
            source lines to form logical source lines.
            ....

So, it's clearly implementation-defined behavior. In this sense both
preprocessor implementations (with or without patch) are standard compliant.

I think this trivial patch make more cleaner solution than any ugly makefile
hacks like dos2unix or tr or whatever... And definitely more user/developer
friendly.

Eugene


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: parse error before `{', stray '\' in program
  2003-04-11 19:04 ` Eugene Surovegin
@ 2003-04-11 20:17   ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2003-04-11 20:17 UTC (permalink / raw)
  To: Eugene Surovegin; +Cc: Ron Flory, linuxppc-embedded


In message <5.1.0.14.2.20030411115316.0416be20@mail.zultys.com> you wrote:
>
>          1. Physical source file multibyte characters are mapped,
>             in an implementation-defined manner, to the source character set
>             (introducing new-line characters for end-of-line indicators)
>              if necessary.
>              ....

"\r\n" is not a  multibyte  character  but  a  sequence  of  the  two
characters C and NL.


>          2. Each instance of a backslash character (\) immediately
>             followed by a new-line character is deleted, splicing physical
>             source lines to form logical source lines.
>             ....

This sentence contains the word "immediat" which does not  allow  for
an  additional  CR  character between the backslash character and the
new-line character.

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Our business is run on trust.  We trust you will pay in advance.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2003-04-11 20:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3E96684D.7000601@imc-berlin.de>
2003-04-11  7:24 ` parse error before `{', stray '\' in program Wolfgang Denk
2003-04-11 12:59   ` Ron Flory
     [not found] <5.1.0.14.2.20030411103728.03024f68@mail.ebshome.net>
2003-04-11 19:04 ` Eugene Surovegin
2003-04-11 20:17   ` Wolfgang Denk
     [not found] <791B3205DB661A42B4BFE5464A7D1D02010E44F3@chzugexch02.zug.c h.abatos.com>
2003-04-10 16:47 ` Eugene Surovegin
2003-04-10  9:23 Graf Alex
2003-04-10  9:48 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).