473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

error 'unnamed fields'

Hello, All!

I'm trying to compile some driver for MIPS target, and get errors. I assumed
these may be related to C language.

tigon3.h:2225: unnamed fields of type other than struct or union are not
allowed
tigon3.h:2225: warning: no semicolon at end of struct or union
tigon3.h:2225: syntax error before numeric constant

and so on...

Here is abstract from tigon3.h where compiler complains:

typedef unsigned int LM_UINT32, *PLM_UINT32;
....
typedef volatile LM_UINT32 T3_32BIT_REGISTER, *PT3_32BIT_REGISTER;
....

typedef union T3_CPU
{
struct
{
T3_32BIT_REGISTER mode;
#define CPU_MODE_HALT BIT_10
#define CPU_MODE_RESET BIT_0
T3_32BIT_REGISTER state;
T3_32BIT_REGISTER EventMask;
T3_32BIT_REGISTER reserved1[4];
T3_32BIT_REGISTER PC; /* here error comes */
T3_32BIT_REGISTER Instruction;
T3_32BIT_REGISTER SpadUnderflow;
T3_32BIT_REGISTER WatchdogClear;
T3_32BIT_REGISTER WatchdogVector;
T3_32BIT_REGISTER WatchdogSavedPC;
T3_32BIT_REGISTER HardwareBp;
T3_32BIT_REGISTER reserved2[3];
T3_32BIT_REGISTER WatchdogSavedState;
T3_32BIT_REGISTER LastBrchAddr;
T3_32BIT_REGISTER SpadUnderflowSet;
T3_32BIT_REGISTER reserved3[(0x200-0x50)/4];
T3_32BIT_REGISTER Regs[32];
T3_32BIT_REGISTER reserved4[(0x400-0x280)/4];
}reg;
}T3_CPU, *PT3_CPU;

What may be the reason?

Thanks in advance for hints!

With best regards, Roman Mashak. E-mail: mr*@tusur.ru
May 30 '06 #1
7 2319
Roman Mashak wrote:
Hello, All!

I'm trying to compile some driver for MIPS target, and get errors. I assumed
these may be related to C language.

tigon3.h:2225: unnamed fields of type other than struct or union are not
allowed
tigon3.h:2225: warning: no semicolon at end of struct or union
tigon3.h:2225: syntax error before numeric constant
[snip] T3_32BIT_REGISTER PC; /* here error comes */

[snip]

Have you tried a different name, looks like PC is a macro defined
somewhere else.

--
Ian Collins.
May 30 '06 #2
Hello, Ian!
You wrote on Tue, 30 May 2006 14:29:18 +1200:

??>> fields of type other than struct or union are not
??>> allowed tigon3.h:2225: warning: no semicolon at end of struct or union
??>> tigon3.h:2225: syntax error before numeric constant
??>>
IC> [snip]
??>> T3_32BIT_REGISTER PC; /* here error comes */
IC> [snip]

IC> Have you tried a different name, looks like PC is a macro defined
IC> somewhere else.
It's not defined anywhere in the code, I checked twice.

<OT> Moreover, it's compiled on host machine (x86), but failes only in
cross-compiling case. </OT>

With best regards, Roman Mashak. E-mail: mr*@tusur.ru
May 30 '06 #3
Roman Mashak wrote:
Hello, Ian!
You wrote on Tue, 30 May 2006 14:29:18 +1200:

??>> fields of type other than struct or union are not
??>> allowed tigon3.h:2225: warning: no semicolon at end of struct or union
??>> tigon3.h:2225: syntax error before numeric constant
??>>
IC> [snip]
??>> T3_32BIT_REGISTER PC; /* here error comes */
IC> [snip]

IC> Have you tried a different name, looks like PC is a macro defined
IC> somewhere else.
It's not defined anywhere in the code, I checked twice.

<OT> Moreover, it's compiled on host machine (x86), but failes only in
cross-compiling case. </OT>

Well there must be something wrong with it.

Have you tried

#if defined PC
# error "PC defined"
#endif

--
Ian Collins.
May 30 '06 #4
Hello, Ian!
You wrote on Tue, 30 May 2006 15:58:33 +1200:

IC>>> Have you tried a different name, looks like PC is a macro defined
IC>>> somewhere else.
??>> It's not defined anywhere in the code, I checked twice.
??>>
??>> <OT> Moreover, it's compiled on host machine (x86), but failes only in
??>> cross-compiling case. </OT>
IC> Well there must be something wrong with it.

IC> Have you tried

IC> #if defined PC
IC> # error "PC defined"
IC> #endif
You were right. I checked the driver source code, but it seems like 'PC' was
defined somewhere inside of cross-compiler toolchain. I renamed all
instances and it worked out. Thanks for hint.

With best regards, Roman Mashak. E-mail: mr*@tusur.ru
May 30 '06 #5
On Tue, 30 May 2006 11:05:41 +0900, "Roman Mashak" <mr*@tusur.ru>
wrote:
Hello, All!

I'm trying to compile some driver for MIPS target, and get errors. I assumed
these may be related to C language.

tigon3.h:2225: unnamed fields of type other than struct or union are not
allowed
tigon3.h:2225: warning: no semicolon at end of struct or union
tigon3.h:2225: syntax error before numeric constant

and so on...

Here is abstract from tigon3.h where compiler complains:

typedef unsigned int LM_UINT32, *PLM_UINT32;
Is "LM_UINT32" that much easier to type than "unsigned int"?
...
typedef volatile LM_UINT32 T3_32BIT_REGISTER, *PT3_32BIT_REGISTER;
...

typedef union T3_CPU
You are aware that your union consists of exactly one member? That
member is the untagged structure named reg. Normally a union consists
of multiple members that overlay each other. There are no overlaid
objects here.
{
struct
{
T3_32BIT_REGISTER mode;
#define CPU_MODE_HALT BIT_10
#define CPU_MODE_RESET BIT_0
These really don't belong inside your structure.
T3_32BIT_REGISTER state;
T3_32BIT_REGISTER EventMask;
T3_32BIT_REGISTER reserved1[4];
T3_32BIT_REGISTER PC; /* here error comes */
Already answered else thread.
T3_32BIT_REGISTER Instruction;
T3_32BIT_REGISTER SpadUnderflow;
T3_32BIT_REGISTER WatchdogClear;
T3_32BIT_REGISTER WatchdogVector;
T3_32BIT_REGISTER WatchdogSavedPC;
T3_32BIT_REGISTER HardwareBp;
T3_32BIT_REGISTER reserved2[3];
T3_32BIT_REGISTER WatchdogSavedState;
T3_32BIT_REGISTER LastBrchAddr;
T3_32BIT_REGISTER SpadUnderflowSet;
T3_32BIT_REGISTER reserved3[(0x200-0x50)/4];
T3_32BIT_REGISTER Regs[32];
T3_32BIT_REGISTER reserved4[(0x400-0x280)/4];
}reg;
}T3_CPU, *PT3_CPU;

Remove del for email
May 31 '06 #6
Barry Schwarz <sc******@doezl.net> writes:
On Tue, 30 May 2006 11:05:41 +0900, "Roman Mashak" <mr*@tusur.ru>
wrote:

[...]
Here is abstract from tigon3.h where compiler complains:

typedef unsigned int LM_UINT32, *PLM_UINT32;


Is "LM_UINT32" that much easier to type than "unsigned int"?


No, but it does mean something different. unsigned int can be any
size, from 16 bits up. LM_UINT32 is 32 bits (or else the name is
grossly misleading).

But a better way to do this is to use the standard uint32_t from
<stdint.h> (or uintleast32_t, or uintfast32_t, depending on your
actual requirements). If you don't have <stdint.h>, it's easy enough
to write your own (Google "doug gwyn q8").

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
May 31 '06 #7
Barry Schwartz wrote:
On Tue, 30 May 2006 11:05:41 +0900, "Roman Mashak" <mr*@tusur.ru>
wrote:
{
struct
{
T3_32BIT_REGISTER mode;
#define CPU_MODE_HALT BIT_10
#define CPU_MODE_RESET BIT_0

These really don't belong inside your structure.

But they don't do any harm here and putting them here shows they
'belong' to the mode register. This layout is quite common in embedded
register structure definitions.

--
Ian Collins.
May 31 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Anthony | last post by:
Hello, I have been reading up on unnamed namespaces in the context of hiding classes as mentionned by the GOF Facade pattern description. I was hoping someone could shed some light on this. I...
1
by: Marco Jez | last post by:
What are the requirements imposed by the Standard on unnamed namespaces? I mean, is the hidden name guaranteed to be unique across multiple translation units, or only within the declaring...
3
by: Sandy | last post by:
Hi, I have two files as folllows file1.cpp #include<iostream> using namespace std; namespace { void show(); void fun() { cout<<"fun called\n"; } }
2
by: Frank Roland | last post by:
I know it is possible to use unnamed struct or unions inside of struct like in the following example: typedef struct { union { int moin; char carl; }; int bon; } dastruct;
9
by: Ivan Mascovich | last post by:
Previous posts (and compilers) confirm that class X { friend void Y() ; } ; does not match namespace
12
by: Jalapeno | last post by:
I've a CICS program that uses BMS maps. Our wysiwyg map editor produces it's source in COBOL so I am manually creating C unions to match the COBOL output. Can I convert the FILLER statements to...
9
by: Tom Plunket | last post by:
The project I'm currently on makes heavy use of unnamed structures to represent an "object hierarchy" of a sort. E.g. struct BaseObject { int aMember; int anotherMember; // etc.
9
by: subramanian | last post by:
Hello. Consider the following code fragment : enum TestEnum { val1 = 10, val2 = 100, val3 = 1000 }; class Test { public : enum TestEnum { val1 = 1, val2 val3 }; Test(int i = 0, int j = 0,...
3
by: CrazyJohn | last post by:
Hi guys, This is my first time posting question here, if I break any rules, please kindly point out. And I'm really glad to be a part of this community. Here is my question, Our lecturer...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.