diff --git a/gcc/config/i386/i386-d.c b/gcc/config/i386/i386-d.c index 34f53ba046d5..d8ea32eb984e 100644 --- a/gcc/config/i386/i386-d.c +++ b/gcc/config/i386/i386-d.c @@ -23,6 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "d/d-target.h" #include "d/d-target-def.h" +#include "d/dmd/globaltypes.h" /* For enum LINK. */ /* Implement TARGET_D_CPU_VERSIONS for x86 targets. */ diff --git a/gcc/d/dmd/globals.h b/gcc/d/dmd/globals.h index d9d59d685cad..31a9a78d1123 100644 --- a/gcc/d/dmd/globals.h +++ b/gcc/d/dmd/globals.h @@ -15,63 +15,11 @@ #include "root/outbuffer.h" #include "root/filename.h" #include "compiler.h" +#include "globaltypes.h" // Can't include arraytypes.h here, need to declare these directly. template struct Array; -typedef unsigned char Diagnostic; -enum -{ - DIAGNOSTICerror, // generate an error - DIAGNOSTICinform, // generate a warning - DIAGNOSTICoff // disable diagnostic -}; - -// The state of array bounds checking -typedef unsigned char CHECKENABLE; -enum -{ - CHECKENABLEdefault, // initial value - CHECKENABLEoff, // never do bounds checking - CHECKENABLEon, // always do bounds checking - CHECKENABLEsafeonly // do bounds checking only in @safe functions -}; - -typedef unsigned char CHECKACTION; -enum -{ - CHECKACTION_D, // call D assert on failure - CHECKACTION_C, // call C assert on failure - CHECKACTION_halt // cause program halt on failure -}; - -enum CPU -{ - x87, - mmx, - sse, - sse2, - sse3, - ssse3, - sse4_1, - sse4_2, - avx, // AVX1 instruction set - avx2, // AVX2 instruction set - avx512, // AVX-512 instruction set - - // Special values that don't survive past the command line processing - baseline, // (default) the minimum capability CPU - native // the machine the compiler is being run on -}; - -enum CppStdRevision -{ - CppStdRevisionCpp98 = 199711, - CppStdRevisionCpp11 = 201103, - CppStdRevisionCpp14 = 201402, - CppStdRevisionCpp17 = 201703 -}; - // Put command line switches in here struct Param { @@ -200,11 +148,6 @@ struct Param DString mapfile; }; -typedef unsigned structalign_t; -// magic value means "match whatever the underlying C compiler does" -// other values are all powers of 2 -#define STRUCTALIGN_DEFAULT ((structalign_t) ~0) - struct Global { DString inifilename; @@ -264,23 +207,6 @@ struct Global extern Global global; -// Be careful not to care about sign when using dinteger_t -// use this instead of integer_t to -// avoid conflicts with system #include's -typedef uint64_t dinteger_t; -// Signed and unsigned variants -typedef int64_t sinteger_t; -typedef uint64_t uinteger_t; - -typedef int8_t d_int8; -typedef uint8_t d_uns8; -typedef int16_t d_int16; -typedef uint16_t d_uns16; -typedef int32_t d_int32; -typedef uint32_t d_uns32; -typedef int64_t d_int64; -typedef uint64_t d_uns64; - // file location struct Loc { @@ -300,38 +226,3 @@ struct Loc const char *toChars() const; bool equals(const Loc& loc); }; - -enum LINK -{ - LINKdefault, - LINKd, - LINKc, - LINKcpp, - LINKwindows, - LINKobjc, - LINKsystem -}; - -enum CPPMANGLE -{ - CPPMANGLEdefault, - CPPMANGLEstruct, - CPPMANGLEclass -}; - -enum MATCH -{ - MATCHnomatch, // no match - MATCHconvert, // match with conversions - MATCHconst, // match with conversion to const - MATCHexact // exact match -}; - -enum PINLINE -{ - PINLINEdefault, // as specified on the command line - PINLINEnever, // never inline - PINLINEalways // always inline -}; - -typedef uinteger_t StorageClass; diff --git a/gcc/d/dmd/globaltypes.h b/gcc/d/dmd/globaltypes.h new file mode 100644 index 000000000000..955848eb9453 --- /dev/null +++ b/gcc/d/dmd/globaltypes.h @@ -0,0 +1,123 @@ + +/* Compiler implementation of the D programming language + * Copyright (C) 1999-2021 by The D Language Foundation, All Rights Reserved + * written by Walter Bright + * http://www.digitalmars.com + * Distributed under the Boost Software License, Version 1.0. + * http://www.boost.org/LICENSE_1_0.txt + * https://github.com/dlang/dmd/blob/master/src/dmd/globaltypes.h + */ + +#pragma once + +#include "root/dsystem.h" + +typedef unsigned char Diagnostic; +enum +{ + DIAGNOSTICerror, // generate an error + DIAGNOSTICinform, // generate a warning + DIAGNOSTICoff // disable diagnostic +}; + +// The state of array bounds checking +typedef unsigned char CHECKENABLE; +enum +{ + CHECKENABLEdefault, // initial value + CHECKENABLEoff, // never do bounds checking + CHECKENABLEon, // always do bounds checking + CHECKENABLEsafeonly // do bounds checking only in @safe functions +}; + +typedef unsigned char CHECKACTION; +enum +{ + CHECKACTION_D, // call D assert on failure + CHECKACTION_C, // call C assert on failure + CHECKACTION_halt // cause program halt on failure +}; + +enum CPU +{ + x87, + mmx, + sse, + sse2, + sse3, + ssse3, + sse4_1, + sse4_2, + avx, // AVX1 instruction set + avx2, // AVX2 instruction set + avx512, // AVX-512 instruction set + + // Special values that don't survive past the command line processing + baseline, // (default) the minimum capability CPU + native // the machine the compiler is being run on +}; + +enum CppStdRevision +{ + CppStdRevisionCpp98 = 199711, + CppStdRevisionCpp11 = 201103, + CppStdRevisionCpp14 = 201402, + CppStdRevisionCpp17 = 201703 +}; + +typedef unsigned structalign_t; +// magic value means "match whatever the underlying C compiler does" +// other values are all powers of 2 +#define STRUCTALIGN_DEFAULT ((structalign_t) ~0) + +// Be careful not to care about sign when using dinteger_t +// use this instead of integer_t to +// avoid conflicts with system #include's +typedef uint64_t dinteger_t; +// Signed and unsigned variants +typedef int64_t sinteger_t; +typedef uint64_t uinteger_t; + +typedef int8_t d_int8; +typedef uint8_t d_uns8; +typedef int16_t d_int16; +typedef uint16_t d_uns16; +typedef int32_t d_int32; +typedef uint32_t d_uns32; +typedef int64_t d_int64; +typedef uint64_t d_uns64; + +enum LINK +{ + LINKdefault, + LINKd, + LINKc, + LINKcpp, + LINKwindows, + LINKobjc, + LINKsystem +}; + +enum CPPMANGLE +{ + CPPMANGLEdefault, + CPPMANGLEstruct, + CPPMANGLEclass +}; + +enum MATCH +{ + MATCHnomatch, // no match + MATCHconvert, // match with conversions + MATCHconst, // match with conversion to const + MATCHexact // exact match +}; + +enum PINLINE +{ + PINLINEdefault, // as specified on the command line + PINLINEnever, // never inline + PINLINEalways // always inline +}; + +typedef uinteger_t StorageClass; diff --git a/gcc/d/dmd/root/dsystem.h b/gcc/d/dmd/root/dsystem.h index 3ed8a74eb48c..ae53b79246ea 100644 --- a/gcc/d/dmd/root/dsystem.h +++ b/gcc/d/dmd/root/dsystem.h @@ -21,4 +21,4 @@ #pragma once -#include "d-system.h" +#include "d/d-system.h"