/[svn]/linuxsampler/trunk/src/scriptvm/parser_shared.h
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/parser_shared.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3745 by schoenebeck, Fri Jan 31 10:57:53 2020 UTC revision 3746 by schoenebeck, Sat Feb 15 20:00:55 2020 UTC
# Line 93  do Line 93  do
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

Legend:
Removed from v.3745  
changed lines
  Added in v.3746

  ViewVC Help
Powered by ViewVC