bf67f24098
The purpose of this change is twofold: 1. Source in the bin directory can now use the same assertions as source in the vm directory. The ASSERT macro used by the code in runtime/bin was just defined to use assert from the standard C library. 2. Moving other implementation parts from runtime/vm to runtime/platform (e.g. classes Monitor and Mutex) for sharing between runtime/bin and runtime/vm will be easier as these implementations rely on these assertion macros. Created two gypi files for the platform directory. One for the headers and one for the source. The source one is only included when building the VM library and will be present in libdart.a when the dart executable is linked. All the code for asserts is still in the dart namespace. Also re-arranged the order of includes to be alphabetically in the files touched. R=ager@google.com, iposva@google.com BUG= TEST= Review URL: http://codereview.chromium.org//9189003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef VM_FLAGS_H_
|
|
#define VM_FLAGS_H_
|
|
|
|
#include "platform/assert.h"
|
|
#include "vm/globals.h"
|
|
|
|
typedef const char* charp;
|
|
|
|
#define DECLARE_FLAG(type, name) \
|
|
extern type FLAG_##name
|
|
|
|
#define DEFINE_FLAG(type, name, default_value, comment) \
|
|
type FLAG_##name = Flags::Register_##type(&FLAG_##name, \
|
|
#name, \
|
|
default_value, \
|
|
comment)
|
|
|
|
|
|
#if defined(DEBUG)
|
|
#define DECLARE_DEBUG_FLAG(type, name) DECLARE_FLAG(type, name)
|
|
#define DEFINE_DEBUG_FLAG(type, name, default_value, comment) \
|
|
DEFINE_FLAG(type, name, default_value, comment)
|
|
#else
|
|
#define DECLARE_DEBUG_FLAG(type, name)
|
|
#define DEFINE_DEBUG_FLAG(type, name, default_value, comment)
|
|
#endif
|
|
|
|
namespace dart {
|
|
|
|
// Forward declaration.
|
|
class Flag;
|
|
|
|
class Flags {
|
|
public:
|
|
static bool Register_bool(bool* addr,
|
|
const char* name,
|
|
bool default_value,
|
|
const char* comment);
|
|
|
|
static int Register_int(int* addr,
|
|
const char* name,
|
|
int default_value,
|
|
const char* comment);
|
|
|
|
static const char* Register_charp(charp* addr,
|
|
const char* name,
|
|
const char* default_value,
|
|
const char* comment);
|
|
|
|
static bool ProcessCommandLineFlags(int argc, const char** argv);
|
|
|
|
static Flag* Lookup(const char* name);
|
|
|
|
static bool Initialized() { return initialized_; }
|
|
|
|
private:
|
|
static Flag* flags_;
|
|
|
|
static bool initialized_;
|
|
|
|
static void Parse(const char* option);
|
|
|
|
// Testing needs direct access to private methods.
|
|
friend void Dart_TestParseFlags();
|
|
|
|
DISALLOW_ALLOCATION();
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Flags);
|
|
};
|
|
|
|
} // namespace dart
|
|
|
|
#endif // VM_FLAGS_H_
|