1 
2 /* Compiler implementation of the D programming language
3  * Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
4  * written by Walter Bright
5  * http://www.digitalmars.com
6  * Distributed under the Boost Software License, Version 1.0.
7  * http://www.boost.org/LICENSE_1_0.txt
8  * https://github.com/dlang/dmd/blob/master/src/dmd/mars.h
9  */
10 
11 #pragma once
12 
13 /*
14 It is very important to use version control macros correctly - the
15 idea is that host and target are independent. If these are done
16 correctly, cross compilers can be built.
17 The host compiler and host operating system are also different,
18 and are predefined by the host compiler. The ones used in
19 dmd are:
20 
21 Macros defined by the compiler, not the code:
22 
23     Compiler:
24         __DMC__         Digital Mars compiler
25         _MSC_VER        Microsoft compiler
26         __GNUC__        Gnu compiler
27         __clang__       Clang compiler
28 
29     Host operating system:
30         _WIN32          Microsoft NT, Windows 95, Windows 98, Win32s,
31                         Windows 2000, Win XP, Vista
32         _WIN64          Windows for AMD64
33         __linux__       Linux
34         __APPLE__       Mac OSX
35         __FreeBSD__     FreeBSD
36         __OpenBSD__     OpenBSD
37         __sun           Solaris, OpenSolaris, SunOS, OpenIndiana, etc
38 
39 For the target systems, there are the target operating system and
40 the target object file format:
41 
42     Target operating system:
43         TARGET_WINDOS   Covers 32 bit windows and 64 bit windows
44         TARGET_LINUX    Covers 32 and 64 bit linux
45         TARGET_OSX      Covers 32 and 64 bit Mac OSX
46         TARGET_FREEBSD  Covers 32 and 64 bit FreeBSD
47         TARGET_OPENBSD  Covers 32 and 64 bit OpenBSD
48         TARGET_SOLARIS  Covers 32 and 64 bit Solaris
49 
50     It is expected that the compiler for each platform will be able
51     to generate 32 and 64 bit code from the same compiler binary.
52 
53     There are currently no macros for byte endianness order.
54  */
55 
56 
57 #include "root/dsystem.h"
58 
59 #ifdef __DMC__
60 #ifdef DEBUG
61 #undef assert
62 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt())))
63 #endif
64 #endif
65 
66 void unittests();
67 
68 struct OutBuffer;
69 
70 #include "globals.h"
71 
72 #include "root/ctfloat.h"
73 
74 #include "complex_t.h"
75 
76 #include "errors.h"
77 
78 class Dsymbol;
79 class Library;
80 struct File;
81 void obj_start(char *srcfile);
82 void obj_end(Library *library, File *objfile);
83 void obj_append(Dsymbol *s);
84 void obj_write_deferred(Library *library);
85 
86 /// Utility functions used by both main and frontend.
87 void readFile(Loc loc, File *f);
88 void writeFile(Loc loc, File *f);
89 void ensurePathToNameExists(Loc loc, const char *name);
90 
91 const char *importHint(const char *s);
92 /// Little helper function for writing out deps.
93 void escapePath(OutBuffer *buf, const char *fname);
94