Fix some indentation in linespec.c
[deliverable/binutils-gdb.git] / gold / dwp.h
CommitLineData
77429909
CC
1// dwp.h -- general definitions for dwp.
2
219d1afa 3// Copyright (C) 2012-2018 Free Software Foundation, Inc.
77429909
CC
4// Written by Cary Coutant <ccoutant@google.com>.
5
6// This file is part of dwp, the DWARF packaging utility.
7
8// This program is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21// MA 02110-1301, USA.
22
23#ifndef DWP_DWP_H
24#define DWP_DWP_H 1
25
26#include "config.h"
27#include "ansidecl.h"
28
29#include <cstddef>
30#include <cstdlib>
31#include <cstring>
32#include <stdint.h>
33#include <sys/types.h>
34
35#include "system.h"
36
37namespace gold
38{
39
40extern const char* program_name;
41
42class General_options;
43class Command_line;
44class Dirsearch;
45class Input_objects;
46class Mapfile;
47class Symbol;
48class Symbol_table;
49class Layout;
50class Task;
51class Workqueue;
52class Output_file;
53template<int size, bool big_endian>
54struct Relocate_info;
55
56// The size of a section if we are going to look at the contents.
57typedef size_t section_size_type;
58
59// An offset within a section when we are looking at the contents.
60typedef ptrdiff_t section_offset_type;
61
62inline bool
63is_prefix_of(const char* prefix, const char* str)
64{
65 return strncmp(prefix, str, strlen(prefix)) == 0;
66}
67
68// Exit status codes.
69
70enum Exit_status
71{
72 GOLD_OK = EXIT_SUCCESS,
73 GOLD_ERR = EXIT_FAILURE,
74 GOLD_FALLBACK = EXIT_FAILURE + 1
75};
76
77// This function is called to exit the program. Status is true to
78// exit success (0) and false to exit failure (1).
79extern void
80gold_exit(Exit_status status) ATTRIBUTE_NORETURN;
81
82// This function is called to emit an error message and then
83// immediately exit with failure.
84extern void
85gold_fatal(const char* format, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
86
87// This function is called to issue a warning.
88extern void
89gold_warning(const char* msg, ...) ATTRIBUTE_PRINTF_1;
90
94e49e16
CC
91// This function is called to print an informational message.
92extern void
93gold_info(const char* msg, ...) ATTRIBUTE_PRINTF_1;
94
77429909
CC
95#define gold_unreachable() \
96 (gold::do_gold_unreachable(__FILE__, __LINE__, \
97 static_cast<const char*>(__FUNCTION__)))
98
99extern void do_gold_unreachable(const char*, int, const char*)
100 ATTRIBUTE_NORETURN;
101
102// Assertion check.
103
104#define gold_assert(expr) ((void)(!(expr) ? gold_unreachable(), 0 : 0))
105
106// Convert numeric types without unnoticed loss of precision.
107template<typename To, typename From>
108inline To
109convert_types(const From from)
110{
111 To to = from;
112 gold_assert(static_cast<From>(to) == from);
113 return to;
114}
115
116// A common case of convert_types<>: convert to section_size_type.
117template<typename From>
118inline section_size_type
119convert_to_section_size_type(const From from)
120{ return convert_types<section_size_type, From>(from); }
121
122}; // End namespace gold.
123
124#endif // !defined(DWP_DWP_H)
This page took 0.235148 seconds and 4 git commands to generate.