ctypeslib icon indicating copy to clipboard operation
ctypeslib copied to clipboard

Arithmetic macro not evaluated

Open blueforesticarus opened this issue 4 years ago • 1 comments

Looks like it is misinterpreted as a function-like macro

$ cat test4.h 
#define a 5
#define b 6
#define c (a+b)
#define d c

$ clang2py -k dm test4.h
# -*- coding: utf-8 -*-
#
# TARGET arch is: []
# WORD_SIZE is: 8
# POINTER_SIZE is: 8
# LONGDOUBLE_SIZE is: 16
#
import ctypes

a = 5 # macro
b = 6 # macro
# def c(5+6):  # macro
#    return   
d = # macro
__all__ = \
    ['a', 'b', 'd']

blueforesticarus avatar Mar 09 '21 13:03 blueforesticarus

in cursorhandler -> MACRO_DEFINITION added "print(tokens)"

['a', '5']
['b', '6']
['c', '(', '5', '+', '6', ')']
['d', '']

blueforesticarus avatar Mar 09 '21 13:03 blueforesticarus