monotone

monotone Mtn Source Tree

Root/base.hh

1#ifndef __BASE_HH__
2#define __BASE_HH__
3
4// Copyright (C) 2007 Zack Weinberg <zackw@panix.com>
5//
6// This program is made available under the GNU GPL version 2.0 or
7// greater. See the accompanying file COPYING for details.
8//
9// This program is distributed WITHOUT ANY WARRANTY; without even the
10// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11// PURPOSE.
12
13// This file contains a small number of inclusions and declarations that
14// should be visible to the entire program. Include it first.
15
16// Configuration directives
17#include "config.h"
18
19#define NDEBUG
20#define BOOST_DISABLE_THREADS
21#define BOOST_SP_DISABLE_THREADS
22#define BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
23
24#include <iosfwd>
25#include <string> // it would be nice if there were a <stringfwd>
26
27// this template must be specialized for each type you want to dump
28// (or apply MM() to -- see sanity.hh). there are a few stock dumpers
29// in appropriate places.
30template <typename T>
31void dump(T const &, std::string &)
32{
33 // the compiler will evaluate this somewhat odd construct (and issue an
34 // error) if and only if this base template is instantiated. we do not
35 // use BOOST_STATIC_ASSERT mainly to avoid dragging it in everywhere;
36 // also we get better diagnostics this way (the error tells you what is
37 // wrong, not just that there's an assertion failure).
38 enum dummy { d = (sizeof(struct dump_must_be_specialized_for_this_type)
39 == sizeof(T)) };
40}
41
42// NORETURN(void function()); declares a function that will never return
43// in the normal fashion. a function that invariably throws an exception
44// counts as NORETURN.
45#if defined(__GNUC__)
46#define NORETURN(x) x __attribute__((noreturn))
47#elif defined(_MSC_VER)
48#define NORETURN(x) __declspec(noreturn) x
49#else
50#define NORETURN(x) x
51#endif
52
53// Local Variables:
54// mode: C++
55// fill-column: 76
56// c-file-style: "gnu"
57// indent-tabs-mode: nil
58// End:
59// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
60
61#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status