Files
ldc/backend/cdef.h
Alexey Prokhin f2237662df Squashed 'dmd2/' changes from 10017d5..3443f38
3443f38 Fix issue 7493  Initialization of void[][N]
0b371da foreach can run semantic again
7216e2a fix Issue 7735 - Functions with variadic void[][]... arguments corrupt passed data
4fb2b2a Merge pull request #850 from 9rnsr/fix7773
9c59931 Merge pull request #851 from donc/ctfe7785pointerToVar
407f7e4 Merge pull request #852 from donc/segfault7639
9370f83 Fix issue 7380 Crash trying to use address of variable in struct constructor at module level
240866b Fix issue 7639 Undefined enum AA key crashes compiler
19b7096 Fix issue 7785 [CTFE] ICE when slicing pointer to variable
d9b11f6 fix Issue 7773 - UCFS syntax on built-in attributes too?
296d812 Merge pull request #846 from donc/ctfe7781segfault
65aca2d Merge pull request #848 from donc/regression7751
5576737 Merge pull request #849 from donc/bug7794
0310838 Merge pull request #828 from 9rnsr/fix7751
4027e4f Fix issue 7794 Sea of errors when calling regex() after compile error
59cc12d Fix issue 7781 [CTFE] Segmentation fault on 'mixin({return;}());'
3430947 fix seg fault in fail91.d
948274e Merge pull request #824 from donc/regression7745
22ac4b1 Merge pull request #826 from 9rnsr/fix6659
1c15841 Merge pull request #823 from redstar/mscclean
5f54752 Merge pull request #827 from 9rnsr/fix7694
399e4a3 Merge pull request #844 from donc/regression7782
516f49b Fix issue 7789 [CTFE] null pointer exception on setting array length
d74b354 Fix issue 7782 Regression: ICE with wrong import syntax
0269194 Fix issue 7751 [ICE] (Regression 2.059head) From auto and forward reference
42ad236 Merge pull request #830 from 9rnsr/fix_ufcs
67bf025 Merge pull request #832 from 9rnsr/fix7608
d13f107 Merge pull request #829 from 9rnsr/fix7754
e25cbe2 Merge pull request #834 from 9rnsr/fix2367
7fac235 merge D2 pull #842
c836773 Merge pull request #836 from 9rnsr/fix7757
a2754c5 Merge pull request #839 from 9rnsr/fix7768
4948836 fix Issue 7694 - Internal error: e2ir.c 1251 when calling member function inside struct via alias param
9f23335 Merge pull request #838 from 9rnsr/fix7621
92eba60 Merge pull request #840 from 9rnsr/fix7769
8fae3c2 fix issue 7742 - 'More initializers than fields' error with correct number of fields
6c2d706 to enum
35e4f08 fix Issue 7769 - relax inout rule doesn't work for template function
96a0105 fix Issue 7768 - More readable template error messages
8012d58 Merge pull request #831 from 9rnsr/fix7743
9c0cbdd fix Issue 7621 - Immutable type equivalence problem
f67f313 Merge pull request #833 from 9rnsr/fix7731
29754dd Merge pull request #837 from braddr/cleanup-backend2
374109a restore original binary() function and re-fix the new version
78c04aa fix Issue 7757 - Inout function with lazy inout parameter doesn't compile
50c34e9 fix Issue 7754 - static this() in template is stripped during header gen
11acdff Fix auto tester breaking.
f0b7157 fix Issue 7755 - regression(2.059head): ICE in glue.c
cfceb77 fix Issue 7751 - [ICE] From auto and forward reference
7a86807 fix Issue 2367 - Overloading error with string literals
6039c40 fix Issue 7731 - Assertion failure: 't' on line 7911 in file 'mtype.c'
aea3a39 fix Issue 7608 - __traits(allMembers) is broken
f46f07a fix Issue 7743 - Parsing problem with nothrow delegate
fa9d29f Revert "Revert "Refactor for UFCS property getter/setter resolution.""
d9698d8 Revert "Revert "fix Issue 7722 - Refuse normal functions to be used as properties""
0fbc772 Revert "Revert "Allow property function has two arguments""
07a3b09 fix Issue 6659 - Destructor in range foreach called after initialization
e499d4d Fix issue 7745 Regression(2.059beta) Methods defined in external object files when a pointer to it is taken
79a74e1 Fixes an unknown pragma warning.
2b12052 Fix issue 176 [module] message "module and package have the same name"
90e89a4 Merge pull request #814 from 9rnsr/fix7713
3ab0e79 Merge pull request #818 from donc/assoc7732
b3360e9 Fix issue 7732 [CTFE] wrong code for a struct called AssociativeArray
05f0b08 Merge pull request #779 from 9rnsr/fix7534
867e567 Revert "Allow property function has two arguments"
9171aeb Revert "fix Issue 7722 - Refuse normal functions to be used as properties"
989ced7 Revert "Refactor for UFCS property getter/setter resolution."
e9b5292 Refactor for UFCS property getter/setter resolution.
761d000 fix Issue 7722 - Refuse normal functions to be used as properties
9f5956b Allow property function has two arguments
1a11862 Revert "Allow property function has two arguments"
32f57e5 Revert "fix Issue 7722 - Refuse normal functions to be used as properties"
6489bb4 Revert "Refactor for UFCS property getter/setter resolution."
214296f Merge pull request #817 from 9rnsr/fix_ufcs
c3c7f2a Merge pull request #816 from donc/voidctfe6438
185d031 Refactor for UFCS property getter/setter resolution.
08bf89d fix Issue 7722 - Refuse normal functions to be used as properties
f0e3433 Allow property function has two arguments
1b67ac9 Direct check by Type::reliesOnTident
a3cd7d9 fix Issue 7713 - lambda inference doesn't work on template function argument
1762112 Fix issue 6438 - [CTFE] wrong error "value used before set" when slicing =void array
ace1eca fix complex constant folding
76f9b22 Consider return type covariance.
f700dbc fix Issue 7534 - Allow attribute-overloading of an overridden method
cba8f5c Merge pull request #763 from 9rnsr/fix7578
392d93f Merge pull request #815 from dawgfoto/fixSegFault
e48aba2 merge part of pull #769
d72a17e revert dd5a543
24d860b error(Loc loc,) doesn't abort program
4c79117 Use correct opcodes for moving cfloat from st->xmm and xmm->st
af875ff Merge pull request #785 from braddr/cleanup-backend2
9d3021a remove debugging printfs
b3df5ee Merge pull request #807 from dawgfoto/fix7698
f005537 Merge pull request #802 from dawgfoto/fixVC
65a145d Merge pull request #803 from donc/ctfeunion6681yebblies
1cf39ca Merge pull request #812 from 9rnsr/fix_ufcs
d846c3c Merge pull request #808 from 9rnsr/fix7702
fd0a492 fix Issue 7670 - UFCS problem with @property and structs
1ad35b2 Fix for UFCS with property syntax, and add exhaustive test
96f15a1 Resolve broken build after merging
4712aab fix regression
4e05482 Merge pull request #805 from donc/regression7681
245a107 dt_ functions aren't x86 specific
b35f43a another missing loc in an error() call
001addb minor cleanups
2fb1e46 make util_assert take a const string
907da39 cleanup whitespace in binary(), add binary() that takes the length of the string to search for
59d0425 Merge pull request #804 from braddr/nearsighted
d725eed Merge pull request #806 from donc/ctfe7633equalmsg
12a5c26 Merge pull request #811 from donc/bug7699
4279d5e revert the revert
c895c3b revert pull #809
865fb20 fix Issue 5733 - Calling opDispatch As Template Results in Compiler Infinite Loop
96e16d3 fix Issue 7702 - opDispatch goes into infinite loop
5e343c0 Remove special case for DotIdExp and opDispatch semantic, it isn't need anymore
1a9d607 Fix issue 7699 - Cannot get frame pointer to in contract when compiling with -inline
d1476eb Merge pull request #809 from 9rnsr/fix_funclit
afc7c60 allow out-of-order semantic analysis of fields
17da3a0 fix Issue 7705 - lambda syntax doesn't allow some valid signatures
e29d06d fix issue 7698
911d053 Fix issue 7633 - Missing CTFE error message
3802dde Fix issue 7681 Regression(2.059head):ICE:opCatAssign(delegate) to undefined identifier
8da4121 near-ectomy
cd6dc83 fix Library::error()s format string to take a const char*
f3f03c6 switch to apply()
faf873a fix Issue 3510 - Cannot forward reference a templated type from within a template mixin
23aa2be fix Issue 3509 - Cannot forward reference a template mixin's members in a compile-time context
e81309b Add missing 'loc' to error message.
b6898e3 Fix issue 6681 - struct constructor call is converted to struct literal that breaks union initialization
b79afba long double => longdouble
e48c319 Merge pull request #742 from yebblies/issue5879
d74485a Merge pull request #787 from eco/ddoc-srcfilename
3038cb9 Merge pull request #795 from dawgfoto/fixComment
89a039a Merge pull request #801 from dawgfoto/fix4507
c17c2d8 fix issue 4507
dd86c72 Merge pull request #796 from dawgfoto/fixVC
a516588 Merge pull request #797 from 9rnsr/fix7682
1b9839a Merge pull request #799 from 9rnsr/fix6982
4596774 Merge pull request #800 from 9rnsr/fix_type_deduction
b68d546 forgot about @system
bfe1083 add attributes to toHash
8f819d6 Stop special case in mutableOf/makeMutable with inout type.
319b1a3 Fix the lacks of type merging in Type::mutableOf() and uhSharedOf()
cfe7450 fix Issue 7671 - Broken inout deduction of shared(inout(T[n])) from immutable(int[3])
aca5c37 Stop too eager call of TypeAArray::getImpl() When implicitConvTo(non aa Tstruct => Taarray)
50b2a97 fix Issue 6982 - immutability isn't respected on associative array assignment
a5daa5e fix Issue 7684 - IFTI and shared overload doesn't work
e43fbac fix Issue 7682 - shared array type and "cast() is not an lvalue" error
8191801 cpp_prettyident only needed for C++
4487f75 fix ldval
525647c tparam is the specialization
f893925 fix issue 7592 d847c1c2dd
108b25d Merge pull request #780 from 9rnsr/fix7641
105a51f Merge pull request #784 from 9rnsr/fix7110
8b5b67f Merge pull request #792 from donc/bug7667
f72f237 fix Issue 3682 - Regression(2.038) is expression fails to match types
436b711 Fix issue 7667. ICE(interpret.c): 'ctfeStack.stackPointer() == 0'
9005276 Merge pull request #679 from yebblies/issue783
350a3ce Merge pull request #582 from 9rnsr/fix3382_ufcs
5f020c3 Merge pull request #788 from braddr/cleanup-backend3
6aa91cf Merge pull request #790 from p0nce/master
351d595 remove tls bracketing
a137d72 Fix bug #6391
6ce219c remove some of the bracketing
aec4c13 fix Issue 7578 - ICE on indexing result of vararg opDispatch
95e3dc1 Fix unintended infinite loop in Phobos build
b66196a fix Issue 3382 - [tdpl] Implement uniform function call syntax
ee2fe6c Fix 977 is with counting end-of-lines towards msot advanced lexer peeking
7790b16 fix Issue 7650 - Bad lambda inference in associative array literal
c03484e fix Issue 7649 - Bad lambda inference in default function argument
f293a10 fix Issue 7499 - [ICE] ('cast.c line 1495) with lambda array
9f0622c Expression::inferType() and remove FuncExp::setType()
cfc67b7 refactor lambda inference process
6d49586 more de-TX86'ing in relation to a bunch of OP codes
2efbf6a TX86-ectomy in evalu8.c
953f6d7 rip TX86 conditionals out of el.c
d5663c7 fix Issue 7595 - Data being overwritten.
449c165 Add predefined Ddoc macro SRCFILENAME
5c5da66 fix uninitialized field
29cde54 Merge pull request #783 from 9rnsr/fix7038
06d65ab fix Issue 7038 - Type mismatch with const struct
b77e2c9 fix Issue 7110 - opSlice() & opIndex functions works unstable as template arguments
a65f02f Merge pull request #781 from braddr/fix
08d6cd5 Merge pull request #782 from braddr/fixiasm
2492332 fix latent bug with Lexer::peek and recently introduced bug in Lexer::scan
ec1888e initialize popndTmp rather than rely on carefulness when usNumops == 0 and emitting a vector instruction, popndTmp is left uninitialized and is later dereferenced.
1d4a742 Merge pull request #766 from 9rnsr/fix7563
e1cd535 refactor
90f8dcf fix Issue 7641 - std.typecons.Proxy incorrectly allows implicit conversion to class
83a93cf Merge pull request #778 from dawgfoto/MoreSpellCorrection
7f0bcde 2nd go at fix issue 5590
567d7df fix Issue 5590 - Regression(2.036) ICE(e2ir.c): when using .values on enum which is associative array
48ea951 fix Issue 4820 - Regression(1.058, 2.044) in DStress caused by changeset 452
e8f9f3b more spell correction
afd9a45 fix Issue 7618 - delegate/function pointer call bypass parameter storage class
dabcdfb Merge pull request #773 from 9rnsr/fix7583
9846bb2 Merge pull request #774 from donc/ctfe7568
8c20445 Merge pull request #775 from donc/_error6785
d41e58e Avoiding shallow copy is more better.
cccef09 Revert "fix Issue 7585 - functions in templates inferred as delegate"
fc8dfc0 6785 Wrong error message from pragma(msg) of failed instantiation
61ec04d 7568 pragma(msg) segfaults with an aggregate including a class.
4d86d39 Merge pull request #767 from 9rnsr/fix7585
207d351 fix Issue 7583 - [CTFE] ICE with tuple and alias this
53bafa2 fix Issue 7411 - Deduce base type from vector types in templates
5ab1bd9 fix Issue 7518 - std.array.empty doesn't work for shared arrays
a1030d3 fix Issue 7554 - Immutable function pointer arguments too
5e96900 Merge pull request #771 from donc/bug7589
2287ebc fix Issue 7547 - -deps output lists object as a top level module
e611781 7589 __traits(compiles) does not work with a template that fails to compile
0113cde fix Issue 7585 - functions in templates inferred as delegate
4b978d5 fix Issue 7563 - Class members with default template arguments have no type
4d68981 fix Issue 7500 - [ICE] (template.c line 5287) with immutable lambda function
1a39c3c missed a line
6dd89ca Merge pull request #765 from 9rnsr/fix7525
8d6dcac fix Issue 7502 - 2.056 regression: Assigning .init takes forever to compile for large structs
042096e fix Issue 7525 - Broken return type inference for delegate returns
c5affa5 fix Issue 7582 - Untyped nested delegate literals don't compile
121677c fix Issue 7580 - Identity assignment of Nullable crashes dmd
adc0502 Small refactoring to resolve alias this.
1f52383 Merge pull request #671 from yebblies/issue4958
2a12345 fix build breakage
8755819 fix build
ba86204 fix vcbuild
464c664 fix linux build
31197c8 tweaked command line moved some inline asm to C-function to not interfere with optimizations build with VS2011
4dcdc9c increase stack size for win64 build
77262aa add missing include to root
56afe3f batch to build through win32.mak
5a0fd30 build through win32.mak
a5b5190 long_double -> longdouble remove C99 printf add Win64 support
9640110 vcbuild
b619171 Merge pull request #761 from donc/ctfe7473structref
7756328 Merge pull request #725 from kennytm/bug7399-import-too-fatal
bbac9e4 Merge pull request #759 from yebblies/issue1149
d1ff23b 7473 [CTFE] Non-ref argument behaves as if it's a ref argument
ab5cb18 Fix OPmsw codegen - integer only is too restrictive.
a00833b Merge pull request #743 from yebblies/issue3354
b006e11 Merge pull request #757 from 9rnsr/fix7562
3bccbb0 fix Issue 7562 - DMD crashes by using TemplateThisParameter
a7dc50e Merge pull request #749 from yebblies/issue1149
a873c5f Merge pull request #758 from 9rnsr/fix5525
5d639ec fix Issue 5525 - Eponymous templates should allow for overloaded eponymous members
f50852c Merge pull request #729 from donc/gag4269
de02523 fix Issue 3927 - array.length++; is an error, but ++array.length compiles
1dc5bfd Merge pull request #680 from yebblies/issue3812
cf887ba move errors to Dsymbol
fc4acf5 Merge pull request #755 from donc/seaOfErrors7557
be2f3a9 7557b soldier on through dottemplate expressions
8cec825 7557 Sea of errors after template failure
37ec6d6 A small fixup to call Type::defaultInitLiteral
7b5e2cb Revert "Revert "Merge pull request #41 from 9rnsr/rvalue-struct-literal""
3d8f09a Merge branch 'master' of github.com:D-Programming-Language/dmd
7dfb4cc Merge pull request #752 from braddr/cleanup-backend2
1b28f51 Merge branch 'master' of github.com:D-Programming-Language/dmd
31ad73c Merge pull request #746 from yebblies/issue5554
25f770d Change lexer to support # as a token, preserving #line's original behavior
dd8d20a Revert "Merge pull request #41 from 9rnsr/rvalue-struct-literal"
ee2fdf9 Merge pull request #41 from 9rnsr/rvalue-struct-literal
f94fdbf Merge pull request #750 from yebblies/issue3630
61f5fcf Improve codegen for OPmsw
05a3fa4 Merge pull request #744 from Safety0ff/avx-fix
0231d6a Merge pull request #748 from 9rnsr/fix7552
9a97979 Merge pull request #751 from donc/ctfe7536
e091e6e 7536 ctfeAdrOnStack triggered
c9edaf4 fix Issue 7552 - Cannot get and combine a part of overloaded functions
1edeba9 Fix Issue 3630 - bad error location in "has no effect in expression" error
7d0fb72 Fix Issue 5554 - [qtd] Covariance detection failure
4f36aca fix Issue 7550 - Missing AVX instruction VPMULDQ
0b82dfe Fix Issue 5879 - Not all frontend errors use stderr
963a41a Merge pull request #695 from yebblies/refactor_expression
3f06690 Fix Issue 3354 - asm fld x, ST(6); accepted
713f69f Merge pull request #677 from yebblies/issue4241
cf22ce3 Merge pull request #711 from yebblies/issue3559
56ca73c Merge pull request #700 from kennytm/bug7452_lazy_safe
c4dc723 Merge pull request #736 from ibuclaw/in_gcc
121c9b9 Merge pull request #737 from yebblies/issue7544
cedcb3c Merge pull request #740 from yebblies/issue7545
fb3e8f2 Merge pull request #741 from dawgfoto/DMCWarning
5d26c1e Merge pull request #735 from 9rnsr/fix7105
734a921 dmc warning
1e1cfbc Fix Issue 7545 - ICE(cast.c) Merge integral types through alias this
6b135be Fix Issue 7544 - ICE(interpret.c) Catching an exception with a null catch block
c5336f9 Update already existing gdc-specific code, harmonise headers.
44b8d59 Merge pull request #703 from kennytm/bug435_template_ctor
6b368e1 Merge pull request #707 from yebblies/issue3822
8439e07 Merge pull request #717 from yebblies/issue6611
2b4502e fix Issue 7105 - relax inout rules
ac4463a wildsubparam isn't need anymore, because it works properly.
f77879a Issue 6611 - better error message for array post increment/decrement
7393395 Merge pull request #716 from yebblies/issue6685
77568f0 Merge pull request #719 from yebblies/issue4536
9accb04 tired of tdata()
5fbd5a2 Merge pull request #732 from dawgfoto/fix5412
41a901a Revert "hide private/package module level symbols"
23d5e14 Merge pull request #733 from dawgfoto/HideModuleMembers
e2f8a23 hide private/package module level symbols
ae75287 detect collisions with renamed imports
75a2442 fix Dsymbol::search_correct
50e122a Merge pull request #723 from kennytm/bug7504_null_array
c5b7601 Revert "fix 7494 - selective imports in function scope"
aa6f4d9 Revert "fix Protection"
5be660e Revert "fix Imports"
040371b Revert "detect collisions with renamed imports"
0159818 Revert "find private symbols during spell correction"
0c95c45 find private symbols during spell correction
ca22fb2 detect collisions with renamed imports
0dca0af fix Imports
37d4fda fix Protection
16a2e7e fix 7494 - selective imports in function scope
c16f5b2 Merge pull request #667 from 9rnsr/fix7406
f776617 explanatory comments belong in the code, not bugzilla
bfa2060 Merge pull request #704 from donc/_error6699
f46705c fix fail222 regression
28d9635 Merge pull request #708 from donc/soldieron7481
2c2a7af Merge pull request #715 from 9rnsr/fix6738
98cfa64 Merge pull request #722 from 9rnsr/fix7353
b040567 revert pull 724
0e84f63 revert part of pull 724
400f702 Merge pull request #724 from yebblies/issue3632
d82cc74 Merge pull request #720 from yebblies/issue3279
2da3bed Merge pull request #718 from yebblies/fixdebugmsg
f6627ec 7527 [CTFE] Segfault when slicing a pointer at compile time
c8f09bf 4269a Regression(2.031): invalid type accepted if evaluated while errors are gagged
d10fba0 implement const/purity/nothrow/@safe inheritance
ad689fb Fix bug 7399: Broken import statement in trySemantic() causes silent compiler error
eb0c643 Add global.speculativeGag
c18220a Refactor isSpeculativeFunction into Dsymbol
f5c56d8 Issue 3632 - modify float is float to do a bitwise compare
af1cab4 Issue 7353 - NRVO not properly working with inferred return type
03ee438 Fix bug 7504: Cannot assign an object of type 'typeof(null)' to an array
dfb941c Remove debug printing in code that generates errors.
62118e3 Issue 4536 - Typetuples (T...) should have an .init member
989da7b Issue 3279 - Confusing error message when comparing types
36e8045 Issue 6685 - Allow using "with" with rvalues
60cbc6f fix issue 6738 revisited
4e20e7d Issue 3822 - Invalid optimization of alloca called with constant size
b37bf8c Fixes bug 435: Constructors should be templatized
ad8157d Issue 3559 - DMD 1.048+ fails to take function pointer from overloaded member functions
838cd06 7481 Compiler should 'soldier on' after template errors
673063e Simplify fix for 6699
1a0b199 6699a __error when instantiating function template
b6d072d 6699b __error in alias expression
df16ffa 6699c __error in synchronized error message
338f804 7462 Error message with _error_ in overridden function
0f60bd3 7463 Duplicated error message with bad template value parameter
f43e93a 6699E: _error inside error msg for bad base class
5109a5a Fixes bug 7452.
04d888f Refactor XxxAssignExp semantic
73973d6 Issue 3812 - Missing line number for implicit cast of variadic function to array
f0bbf18 Issue 3927 - array.length++; is an error, but ++array.length compiles
24576c2 Issue 783 - Cannot use an array w/ const or variable index as new[] size argument.
7e4cd4b Issue 4241 - duplicate union initialization error doesn't give a file location
9987127 Issue 4958 - Floating point enums should check for total loss of precision
60287fd Issue 7406 - tuple foreach doesn't work with mixed tuples
633d88e Issue 5889 - Struct literal/construction should be rvalue
5d5f78a Now function overloading with ref and non-ref parameter is legal for struct type

git-subtree-dir: dmd2
git-subtree-split: 3443f38fc4c17807a0f36005a05d598cfc7301db
2012-04-05 11:45:25 +04:00

1110 lines
42 KiB
C
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright (C) 1985-1998 by Symantec
// Copyright (C) 2000-2011 by Digital Mars
// All Rights Reserved
// http://www.digitalmars.com
// Written by Walter Bright
/*
* This source file is made available for personal use
* only. The license is in /dmd/src/dmd/backendlicense.txt
* or /dm/src/dmd/backendlicense.txt
* For any other uses, please contact Digital Mars.
*/
/* Macros defined by the compiler, not the code:
Compiler:
__SC__ Symantec compiler
__DMC__ Digital Mars compiler
_MSC_VER Microsoft compiler
__GNUC__ Gnu compiler
__clang__ Clang compiler
__llvm__ Compiler using LLVM as backend (LLVM-GCC/Clang)
Host operating system:
_WIN32 Microsoft NT, Windows 95, Windows 98, Win32s, Windows 2000
_WIN64 Windows for AMD64
linux Linux
__APPLE__ Mac OSX
__FreeBSD__ FreeBSD
__OpenBSD__ OpenBSD
__sun&&__SVR4 Solaris, OpenSolaris (yes, both macros are necessary)
__OS2__ IBM OS/2
DOS386 32 bit DOS extended executable
DOS16RM Rational Systems 286 DOS extender
Compiler executable type:
_WINDLL if building a _WIN32 DLL
Host CPU:
_M_I86 Intel processor
_M_AMD64 AMD 64 processor
Hosts no longer supported:
__INTSIZE==2 16 bit compilations
__OS2__ IBM OS/2
DOS386 32 bit DOS extended executable
DOS16RM Rational Systems 286 DOS extender
_MSDOS MSDOS
One and only one of these macros must be set by the makefile:
SPP Build C/C++ preprocessor
SCPP Build C/C++ compiler
MARS Build Mars compiler
*/
/* Windows/DOS/DOSX Version
* ------------------------
* There are two main issues: hosting the compiler on windows,
* and generating (targetting) windows/dos/dosx executables.
* The "_WIN32" and "__DMC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target linux executables, use OMFOBJ for things specific to the
* OMF object file format, and TARGET_WINDOS for things specific to
* the windows/dos/dosx memory model.
* If this is all done right, one could generate a win/dos/dosx object file
* even when compiling on linux, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
/* Linux Version
* -------------
* There are two main issues: hosting the compiler on linux,
* and generating (targetting) linux executables.
* The "linux" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target linux executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_LINUX for things specific to
* the linux memory model.
* If this is all done right, one could generate a linux object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
/* OSX Version
* -------------
* There are two main issues: hosting the compiler on OSX,
* and generating (targetting) OSX executables.
* The "__APPLE__" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target OSX executables, use MACHOBJ for things specific to the
* MACH-O object file format, and TARGET_OSX for things specific to
* the OSX memory model.
* If this is all done right, one could generate an OSX object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
/* FreeBSD Version
* -------------
* There are two main issues: hosting the compiler on FreeBSD,
* and generating (targetting) FreeBSD executables.
* The "__FreeBSD__" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target FreeBSD executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_FREEBSD for things specific to
* the FreeBSD memory model.
* If this is all done right, one could generate a FreeBSD object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
/* OpenBSD Version
* -------------
* There are two main issues: hosting the compiler on OpenBSD,
* and generating (targetting) OpenBSD executables.
* The "__OpenBSD__" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target OpenBSD executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_FREEBSD for things specific to
* the OpenBSD memory model.
* If this is all done right, one could generate a OpenBSD object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
/* Solaris Version
* -------------
* There are two main issues: hosting the compiler on Solaris,
* and generating (targetting) Solaris executables.
* The "__sun", "__SVR4" and "__GNUC__" macros control hosting issues
* for operating system and compiler dependencies, respectively.
* To target Solaris executables, use ELFOBJ for things specific to the
* ELF object file format, and TARGET_SOLARIS for things specific to
* the Solaris memory model.
* If this is all done right, one could generate a Solaris object file
* even when compiling on win32, and vice versa.
* The compiler source code currently uses these macros very inconsistently
* with these goals, and should be fixed.
*/
#ifndef CDEF_H
#define CDEF_H 1
#define VERSION "8.54.0" // for banner and imbedding in .OBJ file
#define VERSIONHEX "0x854" // for __DMC__ macro
#define VERSIONINT 0x854 // for precompiled headers and DLL version
/***********************************
* Target machine types:
*/
#define TX86 1 // target is Intel 80X86 processor
// Set to 1 using the makefile
#ifndef TARGET_LINUX
#define TARGET_LINUX 0 // target is a linux executable
#endif
// Set to 1 using the makefile
#ifndef TARGET_OSX
#define TARGET_OSX 0 // target is an OSX executable
#endif
// Set to 1 using the makefile
#ifndef TARGET_FREEBSD
#define TARGET_FREEBSD 0 // target is a FreeBSD executable
#endif
// Set to 1 using the makefile
#ifndef TARGET_OPENBSD
#define TARGET_OPENBSD 0 // target is an OpenBSD executable
#endif
// Set to 1 using the makefile
#ifndef TARGET_SOLARIS
#define TARGET_SOLARIS 0 // target is a Solaris executable
#endif
// This is the default
#ifndef TARGET_WINDOS
#define TARGET_WINDOS (!(TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS))
#endif
#if __GNUC__
#include "cdeflnx.h"
#endif
#if _WINDLL
#define SUFFIX "nd"
#elif _WIN64
#define SUFFIX "a"
#elif _WIN32
#define SUFFIX "n"
#elif DOS386
#define SUFFIX "x"
#elif DOS16RM
#define SUFFIX "r"
#else
#define SUFFIX ""
#endif
// C++ Language Features
#define ANGLE_BRACKET_HACK 0 // >> means two template arglist closes
// C Language Features
#define CPP_COMMENT 1 // allow C++ style comments
// C/C++ Language Features
#define PSEUDO_REGS 1
#define INLINE_ASM 1 // support inline assembler
#define HIDDENPARAM_1ST_ARG 1
#define HEADER_LIST 1
#define PASCAL_STRINGS 0
#define KEYWORD_WITH 1
#define EECONTEXT 1
#define LOCALE 0 // locale support for Unicode conversion
#define HEXFLOATS 1 // support hex floating point constants
#define OVERLOAD_CV_PARAM 1 // if int foo(int i) and int foo(const int i)
// are different
#define CPP0X 1 // support C++0x features
// Support generating code for 16 bit memory models
#define SIXTEENBIT (SCPP && TARGET_WINDOS)
/* Set for supporting the FLAT memory model.
* This is not quite the same as !SIXTEENBIT, as one could
* have near/far with 32 bit code.
*/
#define TARGET_SEGMENTED (!MARS && TARGET_WINDOS)
#define STATEMENT_SCOPES CPP
#if __GNUC__
#define LONGLONG 1
#elif __SC__ > 0 && __SC__ < 0x700
#define LONGLONG 0
#else
#define LONGLONG 1 // add in code to support 64 bit integral types
#endif
#if __GNUC__
#define LDOUBLE 0 // no support for true long doubles
#else
#define LDOUBLE (config.exe == EX_NT) // support true long doubles
#endif
#if _MSC_VER
#include "longdouble.h"
#else
typedef long double longdouble;
#endif
// Precompiled header variations
#define MEMORYHX (_WINDLL && _WIN32) // HX and SYM files are cached in memory
#define MMFIO (_WIN32 || linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4) // if memory mapped files
#define LINEARALLOC _WIN32 // if we can reserve address ranges
// H_STYLE takes on one of these precompiled header methods
#define H_NONE 1 // no hydration/dehydration necessary
#define H_BIT0 2 // bit 0 of the pointer determines if pointer
// is dehydrated, an offset is added to
// hydrate it
#define H_OFFSET 4 // the address range of the pointer determines
// if pointer is dehydrated, and an offset is
// added to hydrate it. No dehydration necessary.
#define H_COMPLEX 8 // dehydrated pointers have bit 0 set, hydrated
// pointers are in non-contiguous buffers
// Do we need hydration code
#define HYDRATE (H_STYLE & (H_BIT0 | H_OFFSET | H_COMPLEX))
// Do we need dehydration code
#define DEHYDRATE (H_STYLE & (H_BIT0 | H_COMPLEX))
// Determine hydration style
// NT console: H_NONE
// NT DLL: H_OFFSET
// DOSX: H_COMPLEX
#if MARS
#define H_STYLE H_NONE // precompiled headers only used for C/C++ compiler
#else
#if MMFIO
#if _WINDLL
#define H_STYLE H_OFFSET
#else
#define H_STYLE H_OFFSET //H_NONE
#endif
#elif LINEARALLOC
#define H_STYLE H_BIT0
#else
#define H_STYLE H_COMPLEX
#endif
#endif
// NT structured exception handling
// 0: no support
// 1: old style
// 2: new style
#define NTEXCEPTIONS 2
// indivisible file I/O
#define INDIVFILEIO 1
#define NEWSTATICDTOR 1 // support new style static destructors
// For Shared Code Base
#define TARGET_INLINEFUNC_NAMES
#define PASCAL pascal
#define HINT int
#define UHINT unsigned int
#if _WINDLL
#define dbg_printf dll_printf
#else
#define dbg_printf printf
#endif
#ifndef ERRSTREAM
#define ERRSTREAM stdout
#endif
#define err_printf printf
#define err_vprintf vfprintf
#define err_fputc fputc
#define dbg_fputc fputc
#define LF '\n'
#define LF_STR "\n"
#define CR '\r'
#define ANSI config.ansi_c
#define ANSI_STRICT config.ansi_c
#define ANSI_RELAX config.ansi_c
#ifndef TRIGRAPHS
#define TRIGRAPHS ANSI
#endif
#define ARG_TRUE
#define ARG_FALSE
#define T68000(x)
#define T80x86(x) x
// For Share MEM_ macros - default to mem_xxx package
// PH precompiled header
// PARF parser, life of function
// PARC parser, life of compilation
// BEF back end, function
// BEC back end, compilation
#define MEM_PH_FREE mem_free
#define MEM_PARF_FREE mem_free
#define MEM_PARC_FREE mem_free
#define MEM_BEF_FREE mem_free
#define MEM_BEC_FREE mem_free
#define MEM_PH_CALLOC mem_calloc
#define MEM_PARC_CALLOC mem_calloc
#define MEM_PARF_CALLOC mem_calloc
#define MEM_BEF_CALLOC mem_calloc
#define MEM_BEC_CALLOC mem_calloc
#define MEM_PH_MALLOC mem_malloc
#define MEM_PARC_MALLOC mem_malloc
#define MEM_PARF_MALLOC mem_malloc
#define MEM_BEF_MALLOC mem_malloc
#define MEM_BEC_MALLOC mem_malloc
#define MEM_PH_STRDUP mem_strdup
#define MEM_PARC_STRDUP mem_strdup
#define MEM_PARF_STRDUP mem_strdup
#define MEM_BEF_STRDUP mem_strdup
#define MEM_BEC_STRDUP mem_strdup
#define MEM_PH_REALLOC mem_realloc
#define MEM_PARC_REALLOC mem_realloc
#define MEM_PARF_REALLOC mem_realloc
#define MEM_PERM_REALLOC mem_realloc
#define MEM_BEF_REALLOC mem_realloc
#define MEM_BEC_REALLOC mem_realloc
#define MEM_PH_FREEFP mem_freefp
#define MEM_PARC_FREEFP mem_freefp
#define MEM_PARF_FREEFP mem_freefp
#define MEM_BEF_FREEFP mem_freefp
#define MEM_BEC_FREEFP mem_freefp
// If we can use 386 instruction set (possible in 16 bit code)
#define I386 (config.target_cpu >= TARGET_80386)
// If we are generating 32 bit code
#if MARS
#define I16 0 // no 16 bit code for D
#define I32 (NPTRSIZE == 4)
#define I64 (NPTRSIZE == 8) // 1 if generating 64 bit code
#else
#define I16 (NPTRSIZE == 2)
#define I32 (NPTRSIZE == 4)
#define I64 (NPTRSIZE == 8) // 1 if generating 64 bit code
#endif
/**********************************
* Limits & machine dependent stuff.
*/
/* Define stuff that's different between VAX and IBMPC.
* HOSTBYTESWAPPED TRUE if on the host machine the bytes are
* swapped (TRUE for 6809, 68000, FALSE for 8088
* and VAX).
*/
#define EXIT_BREAK 255 // aborted compile with ^C
/* Take advantage of machines that can store a word, lsb first */
#if _M_I86 // if Intel processor
#define TOWORD(ptr,val) (*(unsigned short *)(ptr) = (unsigned short)(val))
#define TOLONG(ptr,val) (*(unsigned *)(ptr) = (unsigned)(val))
#else
#define TOWORD(ptr,val) (((ptr)[0] = (unsigned char)(val)),\
((ptr)[1] = (unsigned char)((val) >> 8)))
#define TOLONG(ptr,val) (((ptr)[0] = (unsigned char)(val)),\
((ptr)[1] = (unsigned char)((val) >> 8)),\
((ptr)[2] = (unsigned char)((val) >> 16)),\
((ptr)[3] = (unsigned char)((val) >> 24)))
#endif
#define TOOFFSET(a,b) (I32 ? TOLONG(a,b) : TOWORD(a,b))
/***************************
* Target machine data types as they appear on the host.
*/
typedef signed char targ_char;
typedef unsigned char targ_uchar;
typedef signed char targ_schar;
typedef short targ_short;
typedef unsigned short targ_ushort;
typedef int targ_long;
typedef unsigned targ_ulong;
#if LONGLONG
typedef long long targ_llong;
typedef unsigned long long targ_ullong;
#else
#define targ_llong targ_long
#define targ_ullong targ_ulong
#endif
typedef float targ_float;
typedef double targ_double;
typedef longdouble targ_ldouble;
// Extract most significant register from constant
#define MSREG(p) ((REGSIZE == 2) ? (p) >> 16 : ((sizeof(targ_llong) == 8) ? (p) >> 32 : 0))
typedef int targ_int;
typedef unsigned targ_uns;
/* Sizes of base data types in bytes */
#define CHARSIZE 1
#define SHORTSIZE 2
#define WCHARSIZE 2 // 2 for WIN32, 4 for linux/OSX/FreeBSD/OpenBSD/Solaris
#define LONGSIZE 4
#define LLONGSIZE 8
#define CENTSIZE 16
#define FLOATSIZE 4
#define DOUBLESIZE 8
#if TARGET_OSX
#define LNGDBLSIZE 16 // 80 bit reals
#elif TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#define LNGDBLSIZE 12 // 80 bit reals
#else
#define LNGDBLSIZE 10 // 80 bit reals
#endif
#define TMAXSIZE LNGDBLSIZE // largest size a constant can be
#if 0
#define NDPSAVESIZE DOUBLESIZE
#else
#define NDPSAVESIZE LNGDBLSIZE
#endif
#define intsize tysize[TYint]
#define REGSIZE tysize[TYnptr]
#define NPTRSIZE tysize[TYnptr]
#define FPTRSIZE tysize[TYfptr]
#define REGMASK 0xFFFF
// targ_llong is also used to store host pointers, so it should have at least their size
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS || TARGET_OSX || _WIN64
typedef targ_llong targ_ptrdiff_t; /* ptrdiff_t for target machine */
typedef targ_ullong targ_size_t; /* size_t for the target machine */
#else
typedef targ_int targ_ptrdiff_t; /* ptrdiff_t for target machine */
typedef targ_uns targ_size_t; /* size_t for the target machine */
#endif
/* Enable/disable various features
(Some features may no longer work the old way when compiled out,
I don't test the old ways once the new way is set.)
*/
#define THUNKS 1 /* use thunks for virtual functions */
#define SEPNEWDEL 1 // new/delete are not called within the ctor/dtor,
// they are separate
#define VBTABLES 1 // use Microsoft object model
#define UNICODE 1 // support Unicode (wchar_t is unsigned short)
#define DLCMSGS 0 // if 1, have all messages in a file
#define NEWMANGLE TARGET_WINDOS // use MS name mangling scheme
#define NEWTEMPMANGLE (!(config.flags4 & CFG4oldtmangle)) // do new template mangling
#define USEDLLSHELL _WINDLL
#define FARCLASSES 1 // support near/far classes
#define MFUNC (I32) //0 && config.exe == EX_NT) // member functions are TYmfunc
#define AUTONEST 0 // overlap storage of nested auto's
#define CV3 0 // 1 means support CV3 debug format
/* Object module format
*/
#ifndef OMFOBJ
#define OMFOBJ TARGET_WINDOS
#endif
#ifndef ELFOBJ
#define ELFOBJ (TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS)
#endif
#ifndef MACHOBJ
#define MACHOBJ TARGET_OSX
#endif
#define TOOLKIT_H
/* Masks so we can easily check size */
#define CHARMASK (0xFFL)
#define SHORTMASK (0xFFFFL)
#define INTMASK SHORTMASK
#define LONGMASK 0xFFFFFFFF
/* Common constants often checked for */
#if LONGLONG
#define LLONGMASK 0xFFFFFFFFFFFFFFFFLL
#define ZEROLL 0LL
#define MINLL 0x8000000000000000LL
#define MAXLL 0x7FFFFFFFFFFFFFFFLL
#else
#define LLONGMASK 0xFFFFFFFFLL
#define ZEROLL 0L
#define MINLL 0x80000000
#define MAXLL 0x7FFFFFFF
#endif
#ifndef MEMMODELS
#define LARGEDATA (config.memmodel & 6)
#define LARGECODE (config.memmodel & 5)
#define Smodel 0 /* 64k code, 64k data */
#define Mmodel 1 /* large code, 64k data */
#define Cmodel 2 /* 64k code, large data */
#define Lmodel 3 /* large code, large data */
#define Vmodel 4 /* large code, large data, vcm */
#define MEMMODELS 5 /* number of memory models */
#endif
/* Segments */
#define CODE 1 /* code segment */
#define DATA 2 /* initialized data */
#define CDATA 3 /* constant data */
#define UDATA 4 /* uninitialized data */
#define UNKNOWN 0x7FFF // unknown segment
#define DGROUPIDX 1 /* group index of DGROUP */
#define KEEPBITFIELDS 0 /* 0 means code generator cannot handle bit fields, */
/* so replace them with shifts and masks */
#define REGMAX 29 // registers are numbered 0..10
typedef unsigned tym_t; // data type big enough for type masks
typedef int SYMIDX; // symbol table index
#if 0
#if defined(__DMC__) && __DMC__ < 0x81e
typedef int bool;
#endif
#define bool int
#endif
#define _chkstack() (void)0
/* For 32 bit compilations, we don't need far keyword */
#if 1
#define far
#define _far
#define __far
#define __cs
#define __ss
#endif
// gcc defines this for us, dmc doesn't, so look for it's __I86__
#if ! (defined(LITTLE_ENDIAN) || defined(BIG_ENDIAN) )
#if defined(__I86__) || defined(i386) || defined(__x86_64__)
#define LITTLE_ENDIAN 1
#else
#error unknown platform, so unknown endianness
#endif
#endif
#if _WINDLL
#define COPYRIGHT "Copyright <20> 2001 Digital Mars"
#else
#ifdef DEBUG
#define COPYRIGHT "Copyright (C) Digital Mars 2000-2010. All Rights Reserved.\n\
Written by Walter Bright\n\
*****BETA TEST VERSION*****"
#else
#if linux
#define COPYRIGHT "Copyright (C) Digital Mars 2000-2010. All Rights Reserved.\n\
Written by Walter Bright, Linux version by Pat Nelson"
#else
#define COPYRIGHT "Copyright (C) Digital Mars 2000-2010. All Rights Reserved.\n\
Written by Walter Bright"
#endif
#endif
#endif
/**********************************
* Configuration
*/
/* Linkage type */
typedef enum LINKAGE
{
LINK_C, /* C style */
LINK_CPP, /* C++ style */
LINK_PASCAL, /* Pascal style */
LINK_FORTRAN,
LINK_SYSCALL,
LINK_STDCALL,
LINK_D, // D code
LINK_MAXDIM /* array dimension */
} linkage_t;
// This part of the configuration is saved in the precompiled header for use
// in comparing to make sure it hasn't changed.
struct Config
{
char language; // 'C' = C, 'D' = C++
//#define CPP (config.language == 'D')
char version[8]; // = VERSION
char exetype[3]; // distinguish exe types so PH
// files are distinct (= SUFFIX)
char target_cpu; // instruction selection
char target_scheduler; // instruction scheduling (normally same as selection)
#define TARGET_8086 0
#define TARGET_80286 2
#define TARGET_80386 3
#define TARGET_80486 4
#define TARGET_Pentium 5
#define TARGET_PentiumMMX 6
#define TARGET_PentiumPro 7
#define TARGET_PentiumII 8
#define TARGET_AMD64 9 (32 or 64 bit mode)
short versionint; // intermediate file version (= VERSIONINT)
int defstructalign; // struct alignment specified by command line
short hxversion; // HX version number
char fulltypes;
#define CVNONE 0 // No symbolic info
#define CVOLD 1 // Codeview 1 symbolic info
#define CV4 2 // Codeview 4 symbolic info
#define CVSYM 3 // Symantec format
#define CVTDB 4 // Symantec format written to file
#define CVDWARF_C 5 // Dwarf in C format
#define CVDWARF_D 6 // Dwarf in D format
#define CVSTABS 7 // Elf Stabs in C format
unsigned wflags; // flags for Windows code generation
# define WFwindows 1 // generating code for Windows app or DLL
# define WFdll 2 // generating code for Windows DLL
# define WFincbp 4 // mark far stack frame with inc BP / dec BP
# define WFloadds 8 // assume __loadds for all functions
# define WFexpdef 0x10 // generate export definition records for
// exported functions
# define WFss 0x20 // load DS from SS
# define WFreduced 0x40 // skip DS load for non-exported functions
# define WFdgroup 0x80 // load DS from DGROUP
# define WFexport 0x100 // assume __export for all far functions
# define WFds 0x200 // load DS from DS
# define WFmacros 0x400 // define predefined windows macros
# define WFssneds 0x800 // SS != DS
# define WFthunk 0x1000 // use fixups instead of direct ref to CS
# define WFsaveds 0x2000 // use push/pop DS for far functions
# define WFdsnedgroup 0x4000 // DS != DGROUP
# define WFexe 0x8000 // generating code for Windows EXE
bool fpxmmregs; // use XMM registers for floating point
char inline8087; /* 0: emulator
1: IEEE 754 inline 8087 code
2: fast inline 8087 code
*/
short memmodel; // 0:S,X,N,F, 1:M, 2:C, 3:L, 4:V
unsigned exe; // target operating system
#define EX_DOSX 1 // DOSX 386 program
#define EX_ZPM 2 // ZPM 286 program
#define EX_RATIONAL 4 // RATIONAL 286 program
#define EX_PHARLAP 8 // PHARLAP 386 program
#define EX_COM 0x10 // MSDOS .COM program
//#define EX_WIN16 0x20 // Windows 3.x 16 bit program
#define EX_OS2 0x40 // OS/2 2.0 32 bit program
#define EX_OS1 0x80 // OS/2 1.x 16 bit program
#define EX_NT 0x100 // NT
#define EX_MZ 0x200 // MSDOS real mode program
#define EX_XENIX 0x400
#define EX_SCOUNIX 0x800
#define EX_UNIXSVR4 0x1000
#define EX_LINUX 0x2000
#define EX_WIN64 0x4000 // AMD64 and Windows (64 bit mode)
#define EX_LINUX64 0x8000 // AMD64 and Linux (64 bit mode)
#define EX_OSX 0x10000
#define EX_OSX64 0x20000
#define EX_FREEBSD 0x40000
#define EX_FREEBSD64 0x80000
#define EX_SOLARIS 0x100000
#define EX_SOLARIS64 0x200000
#define EX_OPENBSD 0x400000
#define EX_OPENBSD64 0x800000
#define EX_flat (EX_OS2 | EX_NT | EX_LINUX | EX_WIN64 | EX_LINUX64 | \
EX_OSX | EX_OSX64 | EX_FREEBSD | EX_FREEBSD64 | \
EX_OPENBSD | EX_OPENBSD64 | \
EX_SOLARIS | EX_SOLARIS64)
#define EX_dos (EX_DOSX | EX_ZPM | EX_RATIONAL | EX_PHARLAP | \
EX_COM | EX_MZ /*| EX_WIN16*/)
/* CFGX: flags ignored in precompiled headers
* CFGY: flags copied from precompiled headers into current config
*/
unsigned flags;
#define CFGuchar 1 // chars are unsigned
#define CFGsegs 2 // new code seg for each far func
#define CFGtrace 4 // output trace functions
#define CFGglobal 8 // make all static functions global
#define CFGstack 0x20 // add stack overflow checking
#define CFGalwaysframe 0x40 // always generate stack frame
#define CFGnoebp 0x80 // do not use EBP as general purpose register
#define CFGromable 0x100 // put switch tables in code segment
#define CFGeasyomf 0x200 // generate Pharlap Easy-OMF format
#define CFGfarvtbls 0x800 // store vtables in far segments
#define CFGnoinlines 0x1000 // do not inline functions
#define CFGnowarning 0x8000 // disable warnings
#define CFGX (CFGnowarning)
unsigned flags2;
#define CFG2comdat 1 // use initialized common blocks
#define CFG2nodeflib 2 // no default library imbedded in OBJ file
#define CFG2browse 4 // generate browse records
#define CFG2dyntyping 8 // generate dynamic typing information
#define CFG2fulltypes 0x10 // don't optimize CV4 class info
#define CFG2warniserr 0x20 // treat warnings as errors
#define CFG2phauto 0x40 // automatic precompiled headers
#define CFG2phuse 0x80 // use precompiled headers
#define CFG2phgen 0x100 // generate precompiled header
#define CFG2once 0x200 // only include header files once
#define CFG2hdrdebug 0x400 // generate debug info for header
#define CFG2phautoy 0x800 // fast build precompiled headers
#define CFG2noobj 0x1000 // we are not generating a .OBJ file
#define CFG2noerrmax 0x4000 // no error count maximum
#define CFG2expand 0x8000 // expanded output to list file
#define CFG2seh 0x10000 // use Win32 SEH to support any exception handling
#define CFGX2 (CFG2warniserr | CFG2phuse | CFG2phgen | CFG2phauto | \
CFG2once | CFG2hdrdebug | CFG2noobj | CFG2noerrmax | \
CFG2expand | CFG2nodeflib)
unsigned flags3;
#define CFG3ju 1 // char == unsigned char
#define CFG3eh 4 // generate exception handling stuff
#define CFG3strcod 8 // strings are placed in code segment
#define CFG3eseqds 0x10 // ES == DS at all times
#define CFG3ptrchk 0x20 // generate pointer validation code
#define CFG3strictproto 0x40 // strict prototyping
#define CFG3autoproto 0x80 // auto prototyping
#define CFG3rtti 0x100 // add RTTI support
#define CFG3relax 0x200 // relaxed type checking (C only)
#define CFG3cpp 0x400 // C++ compile
#define CFG3igninc 0x800 // ignore standard include directory
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#define CFG3mars 0x1000 // use mars libs and headers
#define NO_FAR (TRUE) // always ignore __far and __huge keywords
#else
#define CFG3nofar 0x1000 // ignore __far and __huge keywords
#define NO_FAR (config.flags3 & CFG3nofar)
#endif
#define CFG3noline 0x2000 // do not output #line directives
#define CFG3comment 0x4000 // leave comments in preprocessed output
#define CFG3cppcomment 0x8000 // allow C++ style comments
#define CFG3wkfloat 0x10000 // make floating point references weak externs
#define CFG3digraphs 0x20000 // support ANSI C++ digraphs
#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#define CFG3semirelax 0x40000 // moderate relaxed type checking
#endif
#define CFG3pic 0x80000 // position independent code
#define CFGX3 (CFG3strcod | CFG3ptrchk)
unsigned flags4;
#define CFG4speed 1 // optimized for speed
#define CFG4space 2 // optimized for space
#define CFG4optimized (CFG4speed | CFG4space)
#define CFG4allcomdat 4 // place all functions in COMDATs
#define CFG4fastfloat 8 // fast floating point (-ff)
#define CFG4fdivcall 0x10 // make function call for FDIV opcodes
#define CFG4tempinst 0x20 // instantiate templates for undefined functions
#define CFG4oldstdmangle 0x40 // do stdcall mangling without @
#define CFG4pascal 0x80 // default to pascal linkage
#define CFG4stdcall 0x100 // default to std calling convention
#define CFG4cacheph 0x200 // cache precompiled headers in memory
#define CFG4alternate 0x400 // if alternate digraph tokens
#define CFG4bool 0x800 // support 'bool' as basic type
#define CFG4wchar_t 0x1000 // support 'wchar_t' as basic type
#define CFG4notempexp 0x2000 // no instantiation of template functions
#define CFG4anew 0x4000 // allow operator new[] and delete[] overloading
#define CFG4oldtmangle 0x8000 // use old template name mangling
#define CFG4dllrtl 0x10000 // link with DLL RTL
#define CFG4noemptybaseopt 0x40000 // turn off empty base class optimization
#define CFG4stackalign CFG4speed // align stack to 8 bytes
#define CFG4nowchar_t 0x80000 // use unsigned short name mangling for wchar_t
#define CFG4forscope 0x100000 // new C++ for scoping rules
#define CFG4warnccast 0x200000 // warn about C style casts
#define CFG4adl 0x400000 // argument dependent lookup
#define CFG4enumoverload 0x800000 // enum overloading
#define CFG4implicitfromvoid 0x1000000 // allow implicit cast from void* to T*
#define CFG4dependent 0x2000000 // dependent / non-dependent lookup
#define CFG4wchar_is_long 0x4000000 // wchar_t is 4 bytes
#define CFG4underscore 0x8000000 // prepend _ for C mangling
#define CFGX4 (CFG4optimized | CFG4fastfloat | CFG4fdivcall | \
CFG4tempinst | CFG4cacheph | CFG4notempexp | \
CFG4stackalign | CFG4dependent)
#define CFGY4 (CFG4nowchar_t | CFG4noemptybaseopt | CFG4adl | \
CFG4enumoverload | CFG4implicitfromvoid | \
CFG4wchar_is_long | CFG4underscore)
unsigned flags5;
#define CFG5debug 1 // compile in __debug code
#define CFG5in 2 // compile in __in code
#define CFG5out 4 // compile in __out code
#define CFG5invariant 8 // compile in __invariant code
#if HTOD
unsigned htodFlags; // configuration for htod
#define HTODFinclude 1 // -hi drill down into #include files
#define HTODFsysinclude 2 // -hs drill down into system #include files
#define HTODFtypedef 4 // -ht drill down into typedefs
#define HTODFcdecl 8 // -hc skip C declarations as comments
#endif
char ansi_c; // strict ANSI C
// 89 for ANSI C89, 99 for ANSI C99
char asian_char; /* 0: normal, 1: Japanese, 2: Chinese */
/* and Taiwanese, 3: Korean */
unsigned threshold; // data larger than threshold is assumed to
// be far (16 bit models only)
#define THRESHMAX 0xFFFF // if threshold == THRESHMAX, all data defaults
// to near
enum LINKAGE linkage; // default function call linkage
};
// Configuration that is not saved in precompiled header
typedef struct Configv
{
char addlinenumbers; // put line number info in .OBJ file
char verbose; // 0: compile quietly (no messages)
// 1: show progress to DLL (default)
// 2: full verbosity
char *csegname; // code segment name
char *deflibname; // default library name
enum LANG language; // message language
int errmax; // max error count
} Configv;
struct Classsym;
struct Symbol;
struct LIST;
struct elem;
typedef unsigned regm_t; // Register mask type
struct immed_t
{ targ_size_t value[REGMAX]; // immediate values in registers
regm_t mval; // Mask of which values in regimmed.value[] are valid
};
struct cse_t
{ elem *value[REGMAX]; // expression values in registers
regm_t mval; // mask of which values in value[] are valid
regm_t mops; // subset of mval that contain common subs that need
// to be stored in csextab[] if they are destroyed
};
struct con_t
{ cse_t cse; // CSEs in registers
immed_t immed; // immediate values in registers
regm_t mvar; // mask of register variables
regm_t mpvar; // mask of SCfastpar register variables
regm_t indexregs; // !=0 if more than 1 uncommitted index register
regm_t used; // mask of registers used
regm_t params; // mask of registers which still contain register
// function parameters
};
/*********************************
* Bootstrap complex types.
*/
#include "bcomplex.h"
/*********************************
* Union of all data types. Storage allocated must be the right
* size of the data on the TARGET, not the host.
*/
struct Cent
{
targ_ullong lsw;
targ_ullong msw;
};
union eve
{
targ_char Vchar;
targ_schar Vschar;
targ_uchar Vuchar;
targ_short Vshort;
targ_ushort Vushort;
targ_int Vint; // also used for tmp numbers (FLtmp)
targ_uns Vuns;
targ_long Vlong;
targ_ulong Vulong;
targ_llong Vllong;
targ_ullong Vullong;
Cent Vcent;
targ_float Vfloat;
targ_double Vdouble;
targ_ldouble Vldouble;
Complex_f Vcfloat; // 2x float
Complex_d Vcdouble; // 2x double
Complex_ld Vcldouble; // 2x long double
targ_size_t Vpointer;
targ_ptrdiff_t Vptrdiff;
targ_uchar Vreg; // register number for OPreg elems
struct // 48 bit 386 far pointer
{ targ_long Voff;
targ_ushort Vseg;
} Vfp;
struct
{
targ_size_t Voffset;// offset from symbol
Symbol *Vsym; // pointer to symbol table
union
{ struct PARAM *Vtal; // template-argument-list for SCfunctempl,
// used only to transmit it to cpp_overload()
LIST *Erd; // OPvar: reaching definitions
} spu;
} sp;
struct
{
targ_size_t Voffset;// member pointer offset
Classsym *Vsym; // struct tag
elem *ethis; // OPrelconst: 'this' for member pointer
} sm;
struct
{
targ_size_t Voffset;// offset from string
char *Vstring; // pointer to string (OPstring or OPasm)
targ_size_t Vstrlen;// length of string
} ss;
struct
{
elem *Eleft; // left child for unary & binary nodes
elem *Eright; // right child for binary nodes
Symbol *Edtor; // OPctor: destructor
} eop;
#if MARS
struct
{
elem *Eleft; // left child for OPddtor
void *Edecl; // VarDeclaration being constructed
} ed; // OPdctor,OPddtor
#endif
}; // variants for each type of elem
// Symbols
#ifdef DEBUG
#define IDSYMBOL IDsymbol,
#else
#define IDSYMBOL
#endif
#if SCPP
#define SYMBOLZERO 0,0,0,
#elif MARS
#define SYMBOLZERO 0,0,
#elif AUTONEST
#define SYMBOLZERO 0,0,
#else
#define SYMBOLZERO
#endif
#if TARGET_LINUX || TARGET_FREEBSD || TARGET_OPENBSD || TARGET_SOLARIS
#define UNIXFIELDS (unsigned)-1,(unsigned)-1,0,0,
#elif TARGET_OSX
#define UNIXFIELDS (unsigned)-1,(unsigned)-1,0,0,0,
#else
#define UNIXFIELDS
#endif
typedef unsigned SYMFLGS;
#if MARS
#define SYM_PREDEF_SZ 40
#else
#define SYM_PREDEF_SZ 22
#endif
#define SYMBOLY(fl,regsaved,name,flags) \
{IDSYMBOL \
(symbol *)0,(symbol *)0,(symbol *)0,(dt_t *)0,(type *)0,{0},\
SYMBOLZERO\
UNIXFIELDS\
SCextern,(fl),(flags),0,0,0,0,0,0,0,{0},(regsaved),{name}}
/**********************************
* Storage classes
* This macro is used to generate parallel tables and the enum values.
*/
#define ENUMSCMAC \
X(unde, SCEXP|SCKEP|SCSCT) /* undefined */ \
X(auto, SCEXP|SCSS|SCRD ) /* automatic (stack) */ \
X(static, SCEXP|SCKEP|SCSCT) /* statically allocated */ \
X(thread, SCEXP|SCKEP ) /* thread local */ \
X(extern, SCEXP|SCKEP|SCSCT) /* external */ \
X(register, SCEXP|SCSS|SCRD ) /* registered variable */ \
X(pseudo, SCEXP ) /* pseudo register variable */ \
X(global, SCEXP|SCKEP|SCSCT) /* top level global definition */ \
X(comdat, SCEXP|SCKEP|SCSCT) /* initialized common block */ \
X(parameter,SCEXP|SCSS ) /* function parameter */ \
X(regpar, SCEXP|SCSS ) /* function register parameter */ \
X(fastpar, SCEXP|SCSS ) /* function parameter passed in register */ \
X(typedef, 0 ) /* type definition */ \
X(explicit, 0 ) /* explicit */ \
X(mutable, 0 ) /* mutable */ \
X(tmp, SCEXP|SCSS|SCRD ) /* compiler generated temporary (just like SCauto \
but doesn't overlay other SCauto's in scoping) */ \
X(label, 0 ) /* goto label */ \
X(struct, SCKEP ) /* struct/class/union tag name */ \
X(enum, 0 ) /* enum tag name */ \
X(field, SCEXP|SCKEP ) /* bit field of struct or union */ \
X(const, SCEXP|SCSCT ) /* constant integer */ \
X(member, SCEXP|SCKEP|SCSCT) /* member of struct or union */ \
X(anon, 0 ) /* member of anonymous union */ \
X(inline, SCEXP|SCKEP ) /* for inline functions */ \
X(sinline, SCEXP|SCKEP ) /* for static inline functions */ \
X(einline, SCEXP|SCKEP ) /* for extern inline functions */ \
X(overload, SCEXP ) /* for overloaded function names */ \
X(friend, 0 ) /* friend of a class */ \
X(virtual, 0 ) /* virtual function */ \
X(locstat, SCEXP|SCSCT ) /* static, but local to a function */ \
X(template, 0 ) /* class template */ \
X(functempl,0 ) /* function template */ \
X(ftexpspec,0 ) /* function template explicit specialization */ \
X(linkage, 0 ) /* function linkage symbol */ \
X(public, SCEXP|SCKEP|SCSCT) /* generate a pubdef for this */ \
X(comdef, SCEXP|SCKEP|SCSCT) /* uninitialized common block */ \
X(bprel, SCEXP|SCSS ) /* variable at fixed offset from frame pointer */ \
X(namespace,0 ) /* namespace */ \
X(alias, 0 ) /* alias to another symbol */ \
X(funcalias,0 ) /* alias to another function symbol */ \
X(memalias,0 ) /* alias to base class member */ \
X(stack, SCEXP|SCSS ) /* offset from stack pointer (not frame pointer) */ \
X(adl, 0 ) /* list of ADL symbols for overloading */ \
//X(union,SCKEP) /* union tag name */
//X(class,SCKEP) /* class tag name */
#define ClassInline(c) ((c) == SCinline || (c) == SCsinline || (c) == SCeinline)
#define SymInline(s) ClassInline((s)->Sclass)
enum SC {
#define X(a,b) SC##a,
ENUMSCMAC // generate the enum values
SCMAX // array dimension
#undef X
};
#define TAG_ARGUMENTS
/*******************************
* Swap two integers.
*/
inline void swap(int *a,int *b)
{ int tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
#endif /* CDEF_H */