* optabs.c (prepare_cmp_insn): Try harder to emit a direct comparison
[official-gcc.git] / libsanitizer / sanitizer_common / sancov_flags.cc
blobe600cdac33cd6d43f771a5e4e6ccb979d4e95a09
1 //===-- sancov_flags.cc -----------------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Sanitizer Coverage runtime flags.
9 //
10 //===----------------------------------------------------------------------===//
12 #include "sancov_flags.h"
13 #include "sanitizer_flag_parser.h"
14 #include "sanitizer_platform.h"
16 SANITIZER_INTERFACE_WEAK_DEF(const char*, __sancov_default_options, void) {
17 return "";
20 using namespace __sanitizer;
22 namespace __sancov {
24 SancovFlags sancov_flags_dont_use_directly; // use via flags();
26 void SancovFlags::SetDefaults() {
27 #define SANCOV_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
28 #include "sancov_flags.inc"
29 #undef SANCOV_FLAG
32 static void RegisterSancovFlags(FlagParser *parser, SancovFlags *f) {
33 #define SANCOV_FLAG(Type, Name, DefaultValue, Description) \
34 RegisterFlag(parser, #Name, Description, &f->Name);
35 #include "sancov_flags.inc"
36 #undef SANCOV_FLAG
39 static const char *MaybeCallSancovDefaultOptions() {
40 return (&__sancov_default_options) ? __sancov_default_options() : "";
43 void InitializeSancovFlags() {
44 SancovFlags *f = sancov_flags();
45 f->SetDefaults();
47 FlagParser parser;
48 RegisterSancovFlags(&parser, f);
50 parser.ParseString(MaybeCallSancovDefaultOptions());
51 parser.ParseString(GetEnv("SANCOV_OPTIONS"));
53 ReportUnrecognizedFlags();
54 if (f->help) parser.PrintFlagDescriptions();
57 } // namespace __sancov