93 |
} \ |
} \ |
94 |
while (0) |
while (0) |
95 |
|
|
96 |
|
// Force YYCOPY() to use copy by value. |
97 |
|
// |
98 |
|
// By default YYCOPY() is using __builtin_memcpy, which is slightly problematic |
99 |
|
// with our YYSTYPE (see above) since it has dynamic objects as member variables |
100 |
|
// and hence __builtin_memcpy would overwrite their vpointer. In practice though |
101 |
|
// this is more of a theoretical fix and probably just silences compiler |
102 |
|
// warnings. So in practice __builtin_memcpy would probably not cause any |
103 |
|
// misbehaviours, because it is expected that Bison generated parsers only use |
104 |
|
// YYCOPY() to relocate the parser's stack (that is moving objects in memory), |
105 |
|
// but not for really creating duplicates of any objects. |
106 |
|
// |
107 |
|
// In my benchmarks I did not encounter any measurable performance difference by |
108 |
|
// this change, so shutting up the compiler wins for now. |
109 |
|
#define YYCOPY(To, From, Count) \ |
110 |
|
do { \ |
111 |
|
for (YYSIZE_T i = 0; i < (Count); ++i) \ |
112 |
|
(To)[i] = (From)[i]; \ |
113 |
|
} while (YYID (0)); \ |
114 |
|
|
115 |
#endif // LS_INSTRSCRIPTSPARSER_SHARED_H |
#endif // LS_INSTRSCRIPTSPARSER_SHARED_H |