jcooper at korgrd dot com
2004-02-12 06:13:35 UTC
On Linux 2.4.24, using gcc 3.3.2
I'm following the instructions as described here:
http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/Type-Attributes.html#Type%20Attributes
Specifically, I say
enum testEnum { x = 1, y = 2 } __attribute__((packed));
and I get:
error: semicolon missing after declaration of `testEnum'
I've also tried:
enum __attribute__((packed)) testEnum2 { z = 3 };
typedef enum { abc = 4 } __attribute__((packed)) testEnum3;
Both which fail with syntax errors. See cpp and gcc output listings below.
It is not practical for us to use -fshort-enums, so we really need this to
work. Please advise!
Thanks
-John
Output of cpp:
# 1 "enum.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "enum.cpp"
enum testEnum { x = 1, y = 2 } __attribute__((packed));
enum __attribute__((packed)) testEnum2 { z = 3 };
typedef enum { abc = 4 } __attribute__((packed)) testEnum3;
int main()
{
testEnum t;
testEnum2 tt;
testEnum3 ttt
}
---------------------------------
Output of gcc -v -save-temps enum.cpp :
Reading specs from /home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/home/jcooper/bin
Thread model: posix
gcc version 3.3.2
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -E -D__GNUG__=3
-quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2
-D_GNU_SOURCE enum.cpp enum.ii
ignoring nonexistent directory "/home/jcooper/bin/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/jcooper/bin/include/c++/3.3.2
/home/jcooper/bin/include/c++/3.3.2/i686-pc-linux-gnu
/home/jcooper/bin/include/c++/3.3.2/backward
/usr/local/include
/home/jcooper/bin/include
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include
/usr/include
End of search list.
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -fpreprocessed
enum.ii -quiet -dumpbase enum.cpp -auxbase enum -version -o enum.s
GNU C++ version 3.3.2 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=36 --param ggc-min-heapsize=11837
enum.cpp:1: error: semicolon missing after declaration of `testEnum'
enum.cpp:3: error: parse error before `__attribute__'
enum.cpp:5: error: semicolon missing after enum declaration
enum.cpp: In function `int main()':
enum.cpp:10: error: `testEnum2' undeclared (first use this function)
enum.cpp:10: error: (Each undeclared identifier is reported only once for each
function it appears in.)
enum.cpp:10: error: parse error before `;' token
--
Summary: enum definition with __attribute__((packed)) gives
syntax errors
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jcooper at korgrd dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14124
I'm following the instructions as described here:
http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/Type-Attributes.html#Type%20Attributes
Specifically, I say
enum testEnum { x = 1, y = 2 } __attribute__((packed));
and I get:
error: semicolon missing after declaration of `testEnum'
I've also tried:
enum __attribute__((packed)) testEnum2 { z = 3 };
typedef enum { abc = 4 } __attribute__((packed)) testEnum3;
Both which fail with syntax errors. See cpp and gcc output listings below.
It is not practical for us to use -fshort-enums, so we really need this to
work. Please advise!
Thanks
-John
Output of cpp:
# 1 "enum.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "enum.cpp"
enum testEnum { x = 1, y = 2 } __attribute__((packed));
enum __attribute__((packed)) testEnum2 { z = 3 };
typedef enum { abc = 4 } __attribute__((packed)) testEnum3;
int main()
{
testEnum t;
testEnum2 tt;
testEnum3 ttt
}
---------------------------------
Output of gcc -v -save-temps enum.cpp :
Reading specs from /home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/home/jcooper/bin
Thread model: posix
gcc version 3.3.2
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -E -D__GNUG__=3
-quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=2
-D_GNU_SOURCE enum.cpp enum.ii
ignoring nonexistent directory "/home/jcooper/bin/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/home/jcooper/bin/include/c++/3.3.2
/home/jcooper/bin/include/c++/3.3.2/i686-pc-linux-gnu
/home/jcooper/bin/include/c++/3.3.2/backward
/usr/local/include
/home/jcooper/bin/include
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include
/usr/include
End of search list.
/home/jcooper/bin/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/cc1plus -fpreprocessed
enum.ii -quiet -dumpbase enum.cpp -auxbase enum -version -o enum.s
GNU C++ version 3.3.2 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.2.
GGC heuristics: --param ggc-min-expand=36 --param ggc-min-heapsize=11837
enum.cpp:1: error: semicolon missing after declaration of `testEnum'
enum.cpp:3: error: parse error before `__attribute__'
enum.cpp:5: error: semicolon missing after enum declaration
enum.cpp: In function `int main()':
enum.cpp:10: error: `testEnum2' undeclared (first use this function)
enum.cpp:10: error: (Each undeclared identifier is reported only once for each
function it appears in.)
enum.cpp:10: error: parse error before `;' token
--
Summary: enum definition with __attribute__((packed)) gives
syntax errors
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jcooper at korgrd dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14124