Skip to content

Commit da205b2

Browse files
authored
backend: remove more C++ declarations (dlang#23156)
* Remove unused cpp RTLSYM, func_t fields, and pef_flags_t * backend: remove more unused C++ types * Remove CPP condition * backend: remove C++ func_flags/storage classes remnants
1 parent 5024a3b commit da205b2

18 files changed

Lines changed: 18 additions & 480 deletions

File tree

compiler/src/dmd/backend/arm/cod2.d

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -894,22 +894,7 @@ void cdcond(ref CGstate cg, ref CodeBuilder cdb,elem* e,ref regm_t pretregs)
894894
else
895895
codelem(cg,cdb1,e21,retregs,false);
896896

897-
if (CPP && e2.Eoper == OPcolon2)
898-
{
899-
code cs;
900-
901-
// This is necessary so that any cleanup code on one branch
902-
// is redone on the other branch.
903-
cs.Iop = PSOP.mark2;
904-
cs.Iflags = 0;
905-
cs.Irex = 0;
906-
cdb.gen(&cs);
907-
cdb.append(cdb1);
908-
cs.Iop = PSOP.release2;
909-
cdb.gen(&cs);
910-
}
911-
else
912-
cdb.append(cdb1);
897+
cdb.append(cdb1);
913898

914899
const regconsave = cg.regcon;
915900
cg.regcon = cast()regconold;

compiler/src/dmd/backend/cc.d

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ alias enum_TK = ubyte;
5252

5353
__gshared Config config;
5454

55-
@trusted
56-
uint CPP() { return config.flags3 & CFG3cpp; }
57-
5855

5956
/////////// Position in source file
6057

@@ -408,50 +405,27 @@ enum
408405
{
409406
Fpending = 1, // if function has been queued for being written
410407
Foutput = 2, // if function has been written out
411-
Foperator = 4, // if operator overload
412-
Fcast = 8, // if cast overload
413408
Finline = 0x10, // if SCinline, and function really is inline
414-
Foverload = 0x20, // if function can be overloaded
415-
Ftypesafe = 0x40, // if function name needs type appended
416-
Fmustoutput = 0x80, // set for forward ref'd functions that
417-
// must be output
418-
Fvirtual = 0x100, // if function is a virtual function
419409
Fctor = 0x200, // if function is a constructor
420410
Fdtor = 0x400, // if function is a destructor
421-
Fnotparent = 0x800, // if function is down Foversym chain
422411
Finlinenest = 0x1000, // used as a marker to prevent nested
423412
// inlines from expanding
424-
Flinkage = 0x2000, // linkage is already specified
425413
Fstatic = 0x4000, // static member function (no this)
426-
Fbitcopy = 0x8000, // it's a simple bitcopy (op=() or X(X&))
427414
Fpure = 0x10000, // pure function
428-
Finstance = 0x20000, // function is an instance of a template
429-
Ffixed = 0x40000, // ctor has had cpp_fixconstructor() run on it,
430-
// dtor has had cpp_fixdestructor()
431-
Fintro = 0x80000, // function doesn't hide a previous virtual function
432-
// unused = 0x100000, // unused bit
433-
Fkeeplink = 0x200000, // don't change linkage to default
434-
Fnodebug = 0x400000, // do not generate debug info for this function
435-
Fgen = 0x800000, // compiler generated function
436415
Finvariant = 0x1000000, // __invariant function
437-
Fexplicit = 0x2000000, // explicit constructor
438-
Fsurrogate = 0x4000000, // surrogate call function
439416
}
440417

441418
alias func_flags3_t = uint;
442419
enum
443420
{
444421
Fvtblgen = 1, // generate vtbl[] when this function is defined
445-
Femptyexc = 2, // empty exception specification (obsolete, use Tflags & TFemptyexc)
446422
Fcppeh = 4, // uses C++ EH
447423
Fnteh = 8, // uses NT Structured EH
448-
Fdeclared = 0x10, // already declared function Symbol
449424
Fmark = 0x20, // has unbalanced OPctor's
450425
Fdoinline = 0x40, // do inline walk
451426
Foverridden = 0x80, // ignore for overriding purposes
452427
Fjmonitor = 0x100, // Mars synchronized function
453428
Fnosideeff = 0x200, // function has no side effects
454-
F3badoparrow = 0x400, // bad operator->()
455429
Fmain = 0x800, // function is D main
456430
Fnested = 0x1000, // D nested function with 'this'
457431
Fmember = 0x2000, // D member function with 'this'
@@ -473,38 +447,11 @@ struct func_t
473447
Symbol* F__func__; // symbol for __func__[] string
474448
func_flags_t Fflags;
475449
func_flags3_t Fflags3;
476-
ubyte Foper; // operator number (OPxxxx) if Foperator
477-
478-
Symbol* Fparsescope; // use this scope to parse friend functions
479-
// which are defined within a class, so the
480-
// class is in scope, but are not members
481-
// of the class
482450

483451
Classsym* Fclass; // if member of a class, this is the class
484452
// (I think this is redundant with Sscope)
485-
Funcsym* Foversym; // overloaded function at same scope
486-
symlist_t Fclassfriends; // Symbol list of classes of which this
487-
// function is a friend
488-
block* Fbaseblock; // block where base initializers get attached
489-
block* Fbaseendblock; // block where member destructors get attached
490-
elem* Fbaseinit; // list of member initializers (meminit_t)
491-
// this field has meaning only for
492-
// functions which are constructors
493-
uint Fsequence; // sequence number at point of definition
494-
Symbol* Ftempl; // if Finstance this is the template that generated it
495453
Funcsym* Falias; // SCfuncalias: function Symbol referenced
496454
// by using-declaration
497-
symlist_t Fthunks; // list of thunks off of this function
498-
param_t* Farglist; // SCfunctempl: the template-parameter-list
499-
param_t* Fptal; // Finstance: this is the template-argument-list
500-
// SCftexpspec: for explicit specialization, this
501-
// is the template-argument-list
502-
list_t Ffwdrefinstances; // SCfunctempl: list of forward referenced instances
503-
list_t Fexcspec; // List of types in the exception-specification
504-
// (NULL if none or empty)
505-
Funcsym* Fexplicitspec; // SCfunctempl, SCftexpspec: threaded list
506-
// of SCftexpspec explicit specializations
507-
Funcsym* Fsurrogatesym; // Fsurrogate: surrogate cast function
508455

509456
char* Fredirect; // redirect function name to this name in object
510457

@@ -527,17 +474,8 @@ struct baseclass_t
527474
Classsym* BCbase; // base class Symbol
528475
baseclass_t* BCnext; // next base class
529476
targ_size_t BCoffset; // offset from start of derived class to this
530-
ushort BCvbtbloff; // for BCFvirtual, offset from start of
531-
// vbtbl[] to entry for this virtual base.
532-
// Valid in Sbase list
533-
symlist_t BCpublics; // public members of base class (list is freeable)
534-
list_t BCmptrlist; // (in Smptrbase only) this is the vtbl
535-
// (NULL if not different from base class's vtbl
536477
Symbol* BCvtbl; // Symbol for vtbl[] array (in Smptrbase list)
537478
// Symbol for vbtbl[] array (in Svbptrbase list)
538-
Classsym* BCparent; // immediate parent of this base class
539-
// in Smptrbase
540-
baseclass_t* BCpbase; // parent base, NULL if did not come from a parent
541479
}
542480

543481
/***********************************
@@ -572,26 +510,9 @@ enum
572510
STRnotagname = 4, // struct/class with no tag name
573511
STRoutdef = 8, // we've output the debug definition
574512
STRbitfields = 0x10, // set if struct contains bit fields
575-
STRabstract = 0x20, // abstract class
576-
STRbitcopy = 0x40, // set if operator=() is merely a bit copy
577-
STRanyctor = 0x80, // set if any constructors were defined
578-
// by the user
579-
STRnoctor = 0x100, // no constructors allowed
580-
STRgen = 0x200, // if struct is an instantiation of a
581-
// template class, and was generated by
582-
// that template
583-
STRvtblext = 0x400, // generate vtbl[] only when first member function
584-
// definition is encountered (see Fvtblgen)
585-
STRexport = 0x800, // all member functions are to be _export
586-
STRpredef = 0x1000, // a predefined struct
587513
STRunion = 0x2000, // actually, it's a union
588514
STRclass = 0x4000, // it's a class, not a struct
589-
STRimport = 0x8000, // imported class
590-
STRstaticmems = 0x10000, // class has static members
591515
STR0size = 0x20000, // zero sized struct
592-
STRinstantiating = 0x40000, // if currently being instantiated
593-
STRexplicit = 0x80000, // if explicit template instantiation
594-
STRgenctor0 = 0x100000, // need to gen X::X()
595516
STRnotpod = 0x200000, // struct is not POD
596517
}
597518

@@ -603,35 +524,11 @@ struct struct_t
603524
uint Salignsize; // size of struct for alignment purposes
604525
ubyte Sstructalign; // struct member alignment in effect
605526
struct_flags_t Sflags;
606-
tym_t ptrtype; // type of pointer to refer to classes by
607527
baseclass_t* Sbase; // list of direct base classes
608-
Symbol* Svptr; // Symbol of vptr
609-
Symbol* Stempsym; // if this struct is an instantiation
610-
// of a template class, this is the
611-
// template class Symbol
612528

613529
// For 64 bit Elf function ABI
614530
type* Sarg1type;
615531
type* Sarg2type;
616-
617-
/* For:
618-
* template<class T> struct A { };
619-
* template<class T> struct A<T *> { };
620-
*
621-
* A<int> a; // primary
622-
* Gives:
623-
* Sarglist = <int>
624-
* Spr_arglist = NULL;
625-
*
626-
* A<int*> a; // specialization
627-
* Gives:
628-
* Sarglist = <int>
629-
* Spr_arglist = <int*>;
630-
*/
631-
632-
param_t* Sarglist; // if this struct is an instantiation
633-
// of a template class, this is the
634-
// actual arg list used
635532
}
636533

637534
/**********************************

compiler/src/dmd/backend/cdef.d

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ else
8383
// Generate cleanup code
8484
enum TERMCODE = 0;
8585

86-
// C++ Language Features
87-
enum ANGLE_BRACKET_HACK = 0; // >> means two template arglist closes
88-
8986
// C/C++ Language Features
9087
enum IMPLIED_PRAGMA_ONCE = 1; // include guards count as #pragma once
9188
enum bool HEADER_LIST = true;
@@ -444,20 +441,7 @@ enum
444441
CFG3strcod = 4, // strings are placed in code segment
445442
CFG3eseqds = 8, // ES == DS at all times
446443
CFG3ptrchk = 0x10, // generate pointer validation code
447-
CFG3strictproto = 0x20, // strict prototyping
448-
CFG3autoproto = 0x40, // auto prototyping
449-
CFG3rtti = 0x80, // add RTTI support
450-
CFG3relax = 0x100, // relaxed type checking (C only)
451-
CFG3cpp = 0x200, // C++ compile
452-
CFG3igninc = 0x400, // ignore standard include directory
453-
CFG3mars = 0x800, // use mars libs and headers
454-
CFG3nofar = 0x1000, // ignore __far and __huge keywords
455-
CFG3noline = 0x2000, // do not output #line directives
456-
CFG3comment = 0x4000, // leave comments in preprocessed output
457-
CFG3cppcomment = 0x8000, // allow C++ style comments
458444
CFG3wkfloat = 0x10000, // make floating point references weak externs
459-
CFG3digraphs = 0x20000, // support ANSI C++ digraphs
460-
CFG3semirelax = 0x40000, // moderate relaxed type checking (non-Windows targets)
461445
CFG3pic = 0x80000, // position independent code
462446
CFG3pie = 0x10_0000, // position independent executable (CFG3pic also set)
463447
CFG3ibt = 0x20_0000, // indirect branch tracking
@@ -471,58 +455,14 @@ enum
471455
CFG4allcomdat = 4, // place all functions in COMDATs
472456
CFG4fastfloat = 8, // fast floating point (-ff)
473457
CFG4fdivcall = 0x10, // make function call for FDIV opcodes
474-
CFG4tempinst = 0x20, // instantiate templates for undefined functions
475458
CFG4oldstdmangle = 0x40, // do stdcall mangling without @
476-
CFG4pascal = 0x80, // default to pascal linkage
477-
CFG4stdcall = 0x100, // default to std calling convention
478-
CFG4cacheph = 0x200, // cache precompiled headers in memory
479-
CFG4alternate = 0x400, // if alternate digraph tokens
480459
CFG4bool = 0x800, // support 'bool' as basic type
481-
CFG4wchar_t = 0x1000, // support 'wchar_t' as basic type
482-
CFG4notempexp = 0x2000, // no instantiation of template functions
483-
CFG4anew = 0x4000, // allow operator new[] and delete[] overloading
484-
CFG4oldtmangle = 0x8000, // use old template name mangling
485-
CFG4dllrtl = 0x10000, // link with DLL RTL
486-
CFG4noemptybaseopt = 0x20000, // turn off empty base class optimization
487-
CFG4nowchar_t = 0x40000, // use unsigned short name mangling for wchar_t
488-
CFG4forscope = 0x80000, // new C++ for scoping rules
489-
CFG4warnccast = 0x100000, // warn about C style casts
490-
CFG4adl = 0x200000, // argument dependent lookup
491-
CFG4enumoverload = 0x400000, // enum overloading
492-
CFG4implicitfromvoid = 0x800000, // allow implicit cast from void* to T*
493-
CFG4dependent = 0x1000000, // dependent / non-dependent lookup
494-
CFG4wchar_is_long = 0x2000000, // wchar_t is 4 bytes
495460
CFG4underscore = 0x4000000, // prepend _ for C mangling
496461
}
497462

498463
enum config_flags4_t CFG4optimized = CFG4speed | CFG4space;
499464
enum config_flags4_t CFG4stackalign = CFG4speed; // align stack to 8 bytes
500465

501-
alias config_flags5_t = uint;
502-
enum
503-
{
504-
CFG5debug = 1, // compile in __debug code
505-
CFG5in = 2, // compile in __in code
506-
CFG5out = 4, // compile in __out code
507-
CFG5invariant = 8, // compile in __invariant code
508-
}
509-
510-
/* CFGX: flags ignored in precompiled headers
511-
* CFGY: flags copied from precompiled headers into current config
512-
*/
513-
enum config_flags_t CFGX = CFGnowarning;
514-
enum config_flags2_t CFGX2 = CFG2warniserr | CFG2phuse | CFG2phgen | CFG2phauto |
515-
CFG2once | CFG2hdrdebug | CFG2noobj | CFG2noerrmax |
516-
CFG2expand | CFG2nodeflib | CFG2stomp | CFG2gms;
517-
enum config_flags3_t CFGX3 = CFG3strcod | CFG3ptrchk;
518-
enum config_flags4_t CFGX4 = CFG4optimized | CFG4fastfloat | CFG4fdivcall |
519-
CFG4tempinst | CFG4cacheph | CFG4notempexp |
520-
CFG4stackalign | CFG4dependent;
521-
522-
enum config_flags4_t CFGY4 = CFG4nowchar_t | CFG4noemptybaseopt | CFG4adl |
523-
CFG4enumoverload | CFG4implicitfromvoid |
524-
CFG4wchar_is_long | CFG4underscore;
525-
526466
// Configuration flags for HTOD executable
527467
alias htod_flags_t = uint;
528468
enum
@@ -567,7 +507,6 @@ struct Config
567507
config_flags2_t flags2;
568508
config_flags3_t flags3;
569509
config_flags4_t flags4;
570-
config_flags5_t flags5;
571510

572511
htod_flags_t htodFlags; // configuration for htod
573512
ubyte ansi_c; // strict ANSI C
@@ -707,7 +646,6 @@ enum SC : ubyte
707646
unde, /// undefined
708647
auto_, /// automatic (stack)
709648
static_, /// statically allocated
710-
thread, /// thread local
711649
extern_, /// external
712650
register, /// registered variable
713651
pseudo, /// pseudo register variable
@@ -718,35 +656,20 @@ enum SC : ubyte
718656
fastpar, /// function parameter passed in register
719657
shadowreg, /// function parameter passed in register, shadowed on stack
720658
typedef_, /// type definition
721-
explicit, /// explicit
722-
mutable, /// mutable
723-
label, /// goto label
724659
struct_, /// struct/class/union tag name
725660
enum_, /// enum tag name
726661
field, /// bit field of struct or union
727662
const_, /// constant integer
728663
member, /// member of struct or union
729-
anon, /// member of anonymous union
730664
inline, /// for inline functions
731665
sinline, /// for static inline functions
732666
einline, /// for extern inline functions
733-
overload, /// for overloaded function names
734-
friend, /// friend of a class
735-
virtual, /// virtual function
736667
locstat, /// static, but local to a function
737-
template_, /// class template
738-
functempl, /// function template
739-
ftexpspec, /// function template explicit specialization
740-
linkage, /// function linkage symbol
741-
public_, /// generate a pubdef for this
742668
comdef, /// uninitialized common block
743669
bprel, /// variable at fixed offset from frame pointer
744-
namespace, /// namespace
745670
alias_, /// alias to another symbol
746671
funcalias, /// alias to another function symbol
747-
memalias, /// alias to base class member
748672
stack, /// offset from stack pointer (not frame pointer)
749-
adl, /// list of ADL symbols for overloading
750673
}
751674

752675
enum SCMAX = SC.max + 1;

compiler/src/dmd/backend/cv8.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void cv8_termfile(const(char)[] objfilename)
238238
buf.write16(2 + 1 + 1 + 2 + 1 + VERSION.length + 1);
239239
buf.write16(S_COMPILE);
240240
buf.writeByte(I64 ? 0xD0 : 6); // target machine AMD64 or x86 (Pentium II)
241-
buf.writeByte(config.flags2 & CFG2gms ? (CPP != 0) : 'D'); // language index (C/C++/D)
241+
buf.writeByte(config.flags2 & CFG2gms ? 0 : 'D'); // language index (C/C++/D)
242242
buf.write16(0x800 | (config.inline8087 ? 0 : (1<<3))); // 32-bit, float package
243243
buf.writeByte(VERSION.length + 1);
244244
buf.writeByte('Z');

0 commit comments

Comments
 (0)