Closed dany-on-demand closed 8 months ago
Using latest version. Not sure about this one. Mini repro:
common.h:
#ifndef COMMON_H #define COMMON_H #define IF_MALLOC_ERROR(result) \ if(!result) { \ LOGF("Critical error: malloc failed (%s:%d)", __func__, __LINE__); \ exit(1); \ } #endif
main.c:
#include "common.h" void main() { unsigned char* data = malloc(8 + 1); IF_MALLOC_ERROR(data) }
Results in this error:
Unhandled expr() node {PredefinedExpr} (cur_file: ".\main.c"): &Node{ id: '0x1f7c59b5850' kind_str: 'PredefinedExpr' location: NodeLocation{ offset: 0 file: '' line: 0 source_file: SourceFile{ path: '' } spelling_file: SourceFile{ path: '' } } range: Range{ begin: Begin{ spelling_file: SourceFile{ path: './common.h' } } } previous_declaration: '' name: '__func__' ast_type: AstJsonType{ desugared_qualified: '' qualified: 'const char[10]' } class_modifier: '' tags: '' initialization_type: '' value: '' value_number: 0 opcode: '' ast_argument_type: AstJsonType{ desugared_qualified: '' qualified: '' } array_filler: [] declaration_id: '' label_id: '' is_postfix: false inner: [<circular>] ref_declaration: RefDeclarationNode{ kind_str: '' name: '' kind: BAD } kind: PredefinedExpr current_child_id: 0 is_builtin_type: false redeclarations_count: 0 }
Can be easily fixed by copying the definition, you don't even have to remove the definition from common.h & it works:
#include "common.h" #define IF_MALLOC_ERROR(result) \ if(!result) { \ LOGF("Critical error: malloc failed (%s:%d)", __func__, __LINE__); \ exit(1); \ } void main() { unsigned char* data = malloc(8 + 1); IF_MALLOC_ERROR(data) }
Using latest version. Not sure about this one. Mini repro:
common.h:
main.c:
Results in this error:
Can be easily fixed by copying the definition, you don't even have to remove the definition from common.h & it works:
common.h:
main.c: