static int declarator_pointer_depth = 0;
static int declarator_has_array = 0;
+static int declarator_dllexport = 0;
+static int declarator_dllimport = 0;
+
static enum token_kind declarator_calling_convention = TOK_EOF;
static int global_initializer_accept_symbol_addresses = 0;
static int index = 0;
char *out, suffix[32];
- int stdcall_bytes;
+ int stdcall_bytes, symbol_index;
unsigned long avail, len;
stdcall_bytes = global_symbol_stdcall_stack_bytes (name);
suffix[0] = '\0';
- if (stdcall_bytes > 0) {
+ symbol_index = find_global_symbol (name);
+
+ if (symbol_index >= 0 && global_symbols[symbol_index].kind == GLOBAL_SYMBOL_FUNCTION && global_symbols[symbol_index].calling_convention == TOK_STDCALL && !global_symbols[symbol_index].is_variadic) {
sprintf (suffix, "@%d", stdcall_bytes);
}
} else if (parsed_dllimport) {
report_line_at (get_filename (), get_line_number (), REPORT_ERROR, tok.start, tok.caret, "'__dllexport' and '__dllimport' cannot both be specified");
} else {
+
+ declarator_dllexport = 1;
parsed_dllexport = 1;
+
}
} else if (tok.kind == TOK_DLLIMPORT) {
} else if (parsed_dllexport) {
report_line_at (get_filename (), get_line_number (), REPORT_ERROR, tok.start, tok.caret, "'__dllexport' and '__dllimport' cannot both be specified");
} else {
+
+ declarator_dllimport = 1;
parsed_dllimport = 1;
+
}
}
const char *saved_captured_declarator_name_caret = captured_declarator_name_caret;
enum token_kind saved_declarator_calling_convention = declarator_calling_convention;
+
+ int saved_declarator_dllexport = declarator_dllexport;
+ int saved_declarator_dllimport = declarator_dllimport;
+
unsigned long saved_captured_declarator_name_line = captured_declarator_name_line;
if (top_level) {
declarator_calling_convention = TOK_EOF;
capture_declarator_name_location = 1;
+ declarator_dllexport = 0;
+ declarator_dllimport = 0;
+
captured_declarator_name_location = 0;
captured_declarator_name_start = 0;
captured_declarator_name_caret = 0;
captured_declarator_name_line = saved_captured_declarator_name_line;
} else {
+
declarator_calling_convention = saved_declarator_calling_convention;
+ declarator_dllexport = saved_declarator_dllexport;
+ declarator_dllimport = saved_declarator_dllimport;
+
}
}
}
parse_declarator (&name);
+
+ declaration_dllimport = declaration_dllimport || parsed_dllimport || declarator_dllimport;
apply_typedef_array_to_declarator ();
if (declarator_has_array && declarator_array_unsized && tok.kind == TOK_ASSIGN) {
parse_function_body (name, STORAGE_NONE, 0, 0, 0, 0, DATA_INT & 0x1f, name_line, name_start, name_caret);
- if (parsed_dllexport) {
+ if (parsed_dllexport || declarator_dllexport) {
vec_push (&vec_dllexports, xstrdup (name));
+
+ declarator_dllexport = 0;
parsed_dllexport = 0;
}
declaration_dllimport = parsed_dllimport;
parse_declarator (&name);
+
+ declaration_dllimport = declaration_dllimport || parsed_dllimport || declarator_dllimport;
apply_typedef_array_to_declarator ();
decl_is_pointer = declarator_is_pointer;
if (name && declarator_has_function && (tok.kind == TOK_LBRACE || is_type_start (tok.kind))) {
- if (parsed_dllexport) {
+ if (parsed_dllexport || declarator_dllexport) {
vec_push (&vec_dllexports, xstrdup (name));
+
+ declarator_dllexport = 0;
parsed_dllexport = 0;
}