Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'

Tags:

c

header-files

While compiling a C program in LINUX, I get the foll. error:

stream.h:1123: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
stream.h:1124: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mblk_t'
stream.h:1125: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'mblk_t'

Line 1123,1124 and 1125 are given below:

__STREAMS_EXTERN int adjmsg(mblk_t *mp, register ssize_t length);
__STREAMS_EXTERN mblk_t *allocb(size_t size, unsigned int priority);
__STREAMS_EXTERN mblk_t *copyb(register mblk_t *mp);

The C program includes a header file which in turn includes stream.h Any idea how this can be solved?

like image 925
Tinyspark Avatar asked Sep 16 '26 04:09

Tinyspark


2 Answers

It's not really clear the context of your code but it seems to me that you're using the OpenSSL library (or you're doing copy & paste from that source code).

The streams_fastcall macro is defined in the kmem.h header file. Did you include it? If you're just doing copy & paste you simply have to add this lines before your STREAMS_EXTERN definition:

#ifndef streams_fastcall
#if defined __i386__ || defined __x86_64__ || defined __k8__
#define streams_fastcall __attribute__((__regparm__(3)))
#else
#define streams_fastcall
#endif
#endif

Note: streams_fastcall sounds like the Microsoft Specific (but widely used on Windows) calling convention named __fastcall. I guess they used that name because it uses the regparm attribute to specify that some arguments should be passed using registers instead of the stack and this is what __fastcall defines (or simply because it's simply faster! lol)

like image 195
Adriano Repetti Avatar answered Sep 18 '26 18:09

Adriano Repetti


Its pretty clear that __STREAMS_EXTERN is defined in a way that is messing things up.

How is __STREAMS_EXTERN defined?

like image 23
abelenky Avatar answered Sep 18 '26 18:09

abelenky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!