Pelles C > Bug reports

_Pragma

(1/1)

PVozenilek:
Pelles C supports _Pragma from C99. Unfortunately it is buggy.


--- Code: ---#include <stdio.h>
static int i = 0;
static void __cdecl foo(void) {
  ++i;
}
#pragma startup foo // this works, i gets incremented


// this fails to compile
#define BAR() \
  static void __cdecl bar(void) { ++i; } \
  _Pragma("startup bar") \
  /**/

   
BAR()

int main(void)
{
  printf("i = %d\n", i);
  return 0;
}

--- End code ---

Compiler error is:


--- Code: ---Building a.obj.
O:\a\a.c(17): warning #2099: Missing type specifier; assuming 'int'.
O:\a\a.c(17): error #2001: Syntax error: expected ')' but found 'string constant'.
O:\a\a.c(17): error #2001: Syntax error: expected ';' but found ')'.
O:\a\a.c(17): warning #2135: Static 'bar' is not referenced.
*** Error code: 1 ***
Done.

--- End code ---


I had tried all the tricks: adding/removing parenthesis, semicolon, putting the _pragma before/after. Nothing helped.

Navigation

[0] Message Index

Go to full version