File: preproc_cpp.i

package info (click to toggle)
swig 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 46,232 kB
  • sloc: cpp: 54,631; ansic: 29,122; java: 17,530; python: 12,505; cs: 10,369; ruby: 7,232; yacc: 6,477; makefile: 5,965; javascript: 5,520; sh: 5,415; perl: 4,187; php: 3,693; ml: 2,187; lisp: 2,056; tcl: 1,991; xml: 115
file content (106 lines) | stat: -rw-r--r-- 1,960 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
%module preproc_cpp


// Test boolean literals (https://github.com/swig/swig/pull/2394):
#if false
# error "boolean preproc check fail false"
#else
#endif

#if !false
#else
# error "boolean preproc check fail !false"
#endif

#if true
#else
# error "boolean preproc check fail true"
#endif

#if !true
# error "boolean preproc check fail !true"
#else
#endif

#if (true)
#else
# error "boolean preproc check fail (true)"
#endif

#if (0 || true)
#else
# error "boolean preproc check fail (0 || true)"
#endif


// Test alternative operator names (https://github.com/swig/swig/issues/2914):
#if true or 0
#else
# error "boolean preproc check fail true or 0"
#endif

#if true and 1
#else
# error "boolean preproc check fail true and 1"
#endif

#if true xor false
#else
# error "boolean preproc check fail true xor false"
#endif

#if 1 bitor 2
#else
# error "boolean preproc check fail 1 bitor 2"
#endif

#if not(1 bitand 2)
#else
# error "boolean preproc check fail not(1 bitand 2)"
#endif

#if compl 0
#else
# error "boolean preproc check fail compl 0"
#endif

#if (1 bitor 2) not_eq 1
#else
# error "boolean preproc check fail (1 bitor 2) not_eq 1"
#endif


// Regression tests for bugs handling a comma in a comment in a macro:
// - https://github.com/swig/swig/issues/974 (for /* */)
// - https://github.com/swig/swig/pull/1166 (for //)
// Also see preproc.i
%inline %{
#define swig__attribute__(x)
#define TCX_PACKED(d) d swig__attribute__ ((__packed__))


TCX_PACKED (typedef struct tcxMessageTestImpl
{
    int mHeader; /**< comment */
}) tcxMessageTest;


TCX_PACKED (typedef struct tcxMessageBugImpl
{
    int mBid; /**< Bid price and size, check PresentMap if available in message */
}) tcxMessageBug;


TCX_PACKED (typedef struct tcxMessageTestImpl2
{
    int mHeader; ///< comment
}) tcxMessageTest2;


TCX_PACKED (typedef struct tcxMessageBugImpl2
{
    int mBid; ///< Bid price and size, check PresentMap if available in message
}) tcxMessageBug2;


%}