Beispiel #1
0
/* For x86-64, enhance the iteration by looping through REX prefixes.
 */
static void WithREX(TestAllFunction testall,
                    const unsigned int prefix,
                    const size_t prefix_length) {
  char pstr[kBufferSize];
#if NACL_TARGET_SUBARCH == 64
  unsigned char irex;
  unsigned int rprefix;
  /* test with REX prefixes */
  printf("WithREX(testall, %x, %d, %d)\n", prefix,
         (int)prefix_length, gEasyDiffMode);
  if (gEasyDiffMode) {
    printf("With random REX prefix.\n");
    irex = RandomRexPrefix();
    rprefix = AppendPrefixByte(prefix, irex);
    testall(rprefix, prefix_length + 1, StrPrefix(prefix, "XX", pstr));
  } else {
    for (irex = kREXBase; irex < kREXMax; irex++) {
      rprefix = AppendPrefixByte(prefix, irex);
      printf("With REX prefix %x\n", rprefix);
      testall(rprefix, prefix_length + 1, StrPrefix(rprefix, "", pstr));
    }
  }
#endif
  /* test with no REX prefix */
  testall(prefix, prefix_length, StrPrefix(prefix, NULL, pstr));
}
// Returns true if identifier pointed by "mangled_cur" is anonymous
// namespace.
static bool IdentifierIsAnonymousNamespace(State *state) {
  const char anon_prefix[] = "_GLOBAL__N_";
  return (state->number > (int)(sizeof(anon_prefix) - 1) &&  // Should be longer.
          StrPrefix(state->mangled_cur, anon_prefix));
}
// Returns true if the identifier of the given length pointed to by
// "mangled_cur" is anonymous namespace.
static bool IdentifierIsAnonymousNamespace(State *state, int length) {
  static const char anon_prefix[] = "_GLOBAL__N_";
  return (length > (int)sizeof(anon_prefix) - 1 &&  // Should be longer.
          StrPrefix(state->mangled_cur, anon_prefix));
}