cpp and backslashes

Jakub Jelinek jakub at redhat.com
Tue Jan 12 09:16:53 UTC 2010


On Tue, Jan 12, 2010 at 08:06:27AM +0000, Terry Barnaby wrote:
> I am trying to build OpenFOAM on F12 and have a problem with cpp.
> In OpenFOAM cpp is used to pre-process Makefiles to create the build
> environment (yuck). Some of the files contain backslash-newline
> sequences for line continuations. F12's cpp seems to remove the
> backslash but leave the newline in place. so for example:
> 
> LIB_LIBS = \
>      -ltriSurface \
>      -lmeshTools
> 
> becomes:
> 
> LIB_LIBS =
>      -ltriSurface
>      -lmeshTools
> 
> Although I know this is not what cpp is intended for, is this correct behaviour 
> for cpp ?

Yes, the tokens are separated by whitespace, so it is sufficient if they are
again separated by whitespace after preprocessing.  See
http://gcc.gnu.org/PR41445 for details why this changed, in short
without the change the tokens have incorrect location and cause unintended
differences in debug info between direct compilation and compilation where
preprocessing happens separately from compilation.
You can use cpp -P to avoid this (then the output won't be cluttered with
# <line> <filename>
either).

	Jakub


More information about the devel mailing list