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 BOOST_DISABLE_THREADS
20#define BOOST_SP_DISABLE_THREADS
21#define BOOST_MULTI_INDEX_DISABLE_SERIALIZATION
22
23#include <iosfwd>
24#include <string> // it would be nice if there were a <stringfwd>
25
26// this template must be specialized for each type you want to dump
27// (or apply MM() to -- see sanity.hh). there are a few stock dumpers
28// in appropriate places.
29template <typename T>
30void dump(T const &, std::string &)
31{
32 // the compiler will evaluate this somewhat odd construct (and issue an
33 // error) if and only if this base template is instantiated. we do not
34 // use BOOST_STATIC_ASSERT mainly to avoid dragging it in everywhere;
35 // also we get better diagnostics this way (the error tells you what is
36 // wrong, not just that there's an assertion failure).
37 enum dummy { d = (sizeof(struct dump_must_be_specialized_for_this_type)
38 == sizeof(T)) };
39}
40
41// NORETURN(void function()); declares a function that will never return
42// in the normal fashion. a function that invariably throws an exception
43// counts as NORETURN.
44#if defined(__GNUC__)
45#define NORETURN(x) x __attribute__((noreturn))
46#elif defined(_MSC_VER)
47#define NORETURN(x) __declspec(noreturn) x
48#else
49#define NORETURN(x) x
50#endif
51
52// Local Variables:
53// mode: C++
54// fill-column: 76
55// c-file-style: "gnu"
56// indent-tabs-mode: nil
57// End:
58// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
59
60#endif

Archive Download this file

Branches

Tags

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