- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- error: expected an expression
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2011 02:59 AM
тАО04-29-2011 02:59 AM
error: expected an expression
"./src/atk_db.pc", line 679: error #2029: expected an expression
STR_CAT_ALLOC(ps_query, ps_clause);
^
Note: The above code had been running fine on Sun OS 5.8.
The macro definitions are given below:
#define IS_NULL( x ) ((x) == NULL)
#define IS_EMPTY_STRING( x ) (IS_NULL( (x) ) || ((x)[0] == 0))
#define SAFE_STRING( s ) (!IS_NULL((s)) ? (s) : "")
#define P_FREE( x ) \
if ( (x) ) { \
P_free( (x) ); \
(x) = NULL; \
}
#define STR_COPY_ALLOC( d, s ) \
if ( (d) ) { \
P_FREE( (d) ); \
} \
(d) = P_newstr( P_string_va_length(SAFE_STRING((s)), NULL) + 1 ); \
P_string_copy( (d), P_string_va_length(SAFE_STRING((s)), NULL) + 1, SAFE_STRING((s)) );
#define STR_CAT_ALLOC( d, s ) \
if ( (d) ) { \
(d) = P_realloc( (d), P_string_va_length(SAFE_STRING((s)), SAFE_STRING((d)), NULL) + 1, char ); \
P_string_concat( (d), P_string_va_length(SAFE_STRING((s)), SAFE_STRING((d)), NULL) + 1, SAFE_STRING((s)) ); \
} else { \
STR_COPY_ALLOC( (d), (s) ); \
}
If anyone could shed light on this, it would be greatly helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2011 03:56 AM
тАО04-29-2011 03:56 AM
Re: error: expected an expression
Using which compilers?
If you could provide a small (but complete)
test case, then it would be easier to
investigate the right problem.
Most compilers (for UNIX) have a "-E" option
to let you see what the preprocessor puts
out. That might reveal something
interesting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2011 03:24 PM
тАО04-29-2011 03:24 PM
Re: error: expected an expression
As Steven mentioned, you should inspect the .i file output by adding these options: -E -.i
Or you could do:
cc ... +legacy_cpp
This will use the off chip preprocessor before compiling and the compiler will point to the errors in the expanded source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2011 11:31 PM
тАО04-29-2011 11:31 PM
Re: error: expected an expression
Now spotted the exact location of the error:(its pointing at the char keyword)
"./src/atk_db.pc", line 686: error #2029: expected an expression
(ps_query) = P_realloc( (ps_query), P_string_va_length((!((((ps_clause))) == 0L) ? ((ps_clause)) : ""), (!((((ps_query))) == 0L) ? ((ps_query)) : ""), 0L) + 1,char );
^
The char is passed to calculate the size to be allocated.
The macro definition is given below.
#define P_realloc(P, N, T) \
(T *)P_mem_manage((void *)(P), (N) * sizeof(T), P_MEM_MALLOCTRY, \
P_MEM_MALLOCDELAY, FALSE)
Please suggest a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2011 02:20 PM
тАО04-30-2011 02:20 PM
Re: error: expected an expression
What did you change so that it is pointing to a new line?
What does the .i file show for that line?
>The macro definition is given below.
Is that macro defined before its use?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-01-2011 09:08 PM
тАО05-01-2011 09:08 PM
Re: error: expected an expression
"./src/atk_db.pc", line 686: error #2029: expected an expression
(ps_query) = P_realloc( (ps_query), P_string_va_length((!((((ps_clause))) == 0L) ? ((ps_clause)) : ""), (!((((ps_query))) == 0L) ? ((ps_query)) : ""), 0L) + 1,char );
^
Note:The P_realloc is a macro. Even after preprocessing, this macro is not expanded. I have pasted the definition of the macro:
#define P_realloc(P, N, T) \
(T *)P_mem_manage((void *)(P), (N) * sizeof(T), P_MEM_MALLOCTRY, \
P_MEM_MALLOCDELAY, FALSE)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2011 04:06 AM
тАО05-02-2011 04:06 AM
Re: error: expected an expression
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-02-2011 11:26 AM
тАО05-02-2011 11:26 AM
Re: error: expected an expression
You need to use a bigger debugging hammer:
-E -.i +legacy_cpp -Wp,-C,-G
Then scan the .i file for P_realloc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2011 09:20 PM
тАО05-03-2011 09:20 PM
Re: error: expected an expression
-E -.i +legacy_cpp -Wp,-C,-G
Temporary Fix: When I define the below macro in the source file itself, (instead of defining it in another file and including it here), the error is disappears.
#define P_realloc(P, N, T) (T *)P_mem_manage((void *)(P), (N) * sizeof(T), P_MEM_MALLOCTRY, P_MEM_MALLOCDELAY, FALSE)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2011 10:24 PM
тАО05-03-2011 10:24 PM
Re: error: expected an expression
> macro in the source file itself, (instead
> of defining it in another file and
> including it here), the error is
> disappears.
In my (limited) experience, C preprocessors
often care what they read, and in which
order, but they seldom care which file the
directives came from.
> If you could provide a small (but complete)
> test case, then it would be easier to
> investigate the right problem.
Still true.