continued lines not always merged into one long line
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-defaults (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The GCC C preprocessor sometimes incorrectly handles a line continuation by not joining a following line with the current line.
Attached is a simple C file called continued-
struct {\
int x;\
};
Running gcc with the -E option produces the following:
$ gcc -E continued-
# 1 "continued-
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "continued-
struct {
int x;};
As you can see, even though the first line in continued-
The GCC documentation (http://
"A continued line is a line which ends with a backslash, `\'. The backslash is removed and the following line is joined with the current one. No space is inserted, so you may split a line anywhere, even in the middle of a word. (It is generally more readable to split lines only at white space.)"
The observed behavior is inconsistent with this statement from the documentation.
What I expected to see is the following:
$ gcc -E continued-
# 1 "continued-
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "continued-
struct { int x;};
Here's my Ubuntu version information:
$ lsb_release -rd
Description: Ubuntu 12.04.1 LTS
Release: 12.04
And here's the package version information:
$ apt-cache policy gcc-4.6
gcc-4.6:
Installed: 4.6.3-1ubuntu5
Candidate: 4.6.3-1ubuntu5
Version table:
*** 4.6.3-1ubuntu5 0
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: gcc 4:4.6.3-1ubuntu5
ProcVersionSign
Uname: Linux 3.2.0-32-generic i686
NonfreeKernelMo
ApportVersion: 2.0.1-0ubuntu14
Architecture: i386
Date: Mon Nov 5 10:29:32 2012
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release i386 (20100816.1)
ProcEnviron:
TERM=xterm
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to precise on 2012-05-03 (186 days ago)
Changed in gcc-defaults (Ubuntu): | |
status: | New → Invalid |
I'm also able to reproduce this problem in GCC 4.7.2. I've submitted a bug report to the GCC project (bug #55242). It can be viewed at <http:// gcc.gnu. org/bugzilla/ show_bug. cgi?id= 55242>.