Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade frontend & libs to v2.110 #4707

Merged
merged 108 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
9935f97
rename Blockx to BlockState
WalterBright May 9, 2024
f233e5f
Merge remote-tracking branch 'upstream/stable' into merge_stable
ibuclaw May 9, 2024
cbfd8cd
Merge pull request dlang/dmd!16468 from ibuclaw/merge_stable
ibuclaw May 9, 2024
7ea54b9
Fix Bugzilla Issue 24534 : goto can skip declarations in labeled stat…
benjones May 17, 2024
c835b71
Merge pull request dlang/dmd!16510 from benjones/fix24534
dlang-bot May 21, 2024
bea6733
Move overrides() and leastAsSpecialized() to funcsem.d (dlang/dmd!16516)
muscar May 23, 2024
c6862a5
Get rid of obsolete CRuntime_DigitalMars special cases
kinke May 25, 2024
ea0a843
Get rid of obsolete OMF support
kinke May 25, 2024
3e98a2e
Get rid of obsolete DMC mangling special cases
kinke May 25, 2024
264ac43
Get rid of obsolete dmd.{lib,scan}omf modules
kinke May 25, 2024
61e13ab
Revise remaining 32{omf,mscoff} usages
kinke May 25, 2024
ed27eeb
Get rid of some obsolete optlink workarounds
kinke May 25, 2024
defdf07
Get rid of obsolete CppRuntime_DigitalMars special cases
kinke May 25, 2024
ac4c3eb
Get rid of obsolete DMC special cases
kinke May 25, 2024
c7e7f80
Get rid of DMC workaround for the dll_cxx dshell test
kinke May 25, 2024
a3c8076
Merge pull request dlang/dmd!16522 from kinke/rm_omf
dlang-bot May 25, 2024
28d5441
Merge pull request dlang/dmd!16521 from kinke/rm_cruntime_dm
dlang-bot May 25, 2024
4330e26
druntime: Streamline `make clean` for integration tests
kinke May 25, 2024
2fbfd65
Remove some more OMF leftovers
kinke May 25, 2024
c12b4e3
move code_x86.d to x86
WalterBright May 25, 2024
890ca32
Fix bugzilla issue 20243 - inout not substituted for in associative a…
May 26, 2024
decc4e2
Merge remote-tracking branch 'upstream/stable' into merge_stable
ibuclaw May 27, 2024
b670945
Merge pull request dlang/dmd!16534 from ibuclaw/merge_stable
ibuclaw May 27, 2024
eb772ea
Move some semantic functions from func.d to funcsem.d and typesem.d (…
muscar May 27, 2024
201a072
Fix Issue 24135 - Eponymous template member overloads not shown as ca…
ntrel May 31, 2024
aac6223
dmd.mtype: Add workaround for building with version 2.081.x
ibuclaw May 31, 2024
0fcb505
Move checkNRVO() from func.d to funcsem.d (dlang/dmd!16536)
muscar Jun 1, 2024
3ac1ffd
make X86 a positive affirmation (dlang/dmd!16540)
WalterBright Jun 1, 2024
516266b
redo setDefaultLibrary() (dlang/dmd!16548)
WalterBright Jun 1, 2024
a94f440
add driverParams to parseCommandLine() (dlang/dmd!16549)
WalterBright Jun 1, 2024
f907b64
Merge remote-tracking branch 'upstream/stable' into merge_stable
ibuclaw Jun 2, 2024
38cb68d
Merge pull request dlang/dmd!16553 from ibuclaw/merge_stable
ibuclaw Jun 2, 2024
a563374
Move more semantic functions from func.d to funcsem.d and typesem.d (…
muscar Jun 2, 2024
1579d87
backend_init() gets const ref parameters
WalterBright Jun 3, 2024
0a67f93
more X86 affirmation
WalterBright Jun 3, 2024
63400b6
add arm tests (dlang/dmd!16563)
WalterBright Jun 5, 2024
2689276
use ErrorSink in parseCommandLine() (dlang/dmd!16564)
WalterBright Jun 6, 2024
cb87114
remove errors.d from mars.d (dlang/dmd!16565)
WalterBright Jun 6, 2024
4ebf03e
continue with removing errors.d from mars.d
WalterBright Jun 7, 2024
d2d689a
compiler/test/unit/semantic/imports.d: call deinitializeDMD
the-horo Jun 8, 2024
48f5de8
Fix bugzilla 24580 - ImportC: Asm label after attributes results in s…
tim-dlang Jun 8, 2024
236fc66
Fix bugzilla 24577 - Struct with constructor returned from C++ wrong
tim-dlang Jun 8, 2024
824d990
Fix Bugzilla 24598
ibara Jun 10, 2024
857bad8
Add test case for Bugzilla 24590
kinke Jun 11, 2024
e230560
Fix Bugzilla 24590 - Don't run module destructors if druntime failed …
kinke Jun 11, 2024
87bdf57
Android: Use rt.sections_elf_shared, not rt.sections_android
kinke Jun 11, 2024
a7cec65
Fix Issue 23957 - Casting to derived extern(C++) class is unsafe (dla…
ntrel Jun 12, 2024
a69f584
Fix Bugzilla 24582 - Detect unsafe `cast(bool[])` (dlang/dmd!16558)
ntrel Jun 13, 2024
fc9ee89
Add supplemental messages to explain unsafe casts
ntrel Jun 12, 2024
5d2ff51
Fix bugzilla 24579 - stat_t has wrong size for Android armv7a
tim-dlang Jun 15, 2024
87af9a7
Merge remote-tracking branch 'upstream/stable' into merge_stable
ibuclaw Jun 15, 2024
4505cb9
Fix Bugzilla 24603 - Can copy from non-void array into void[] in safe…
ntrel Jun 14, 2024
d3b4adf
Merge pull request dlang/dmd!16589 from ibuclaw/merge_stable
ibuclaw Jun 16, 2024
0ebf780
Fix bugzilla 24592 - ImportC: Bitfield layout wrong for int64 on 32-b…
tim-dlang Jun 16, 2024
6a348d1
Fix Bugzilla 17148 - Copying from const(void)[] to void[] breaks immu…
ntrel Jun 17, 2024
bc4a179
[dmd/expressionsem] Refactor void copy errors
ntrel Jun 17, 2024
f010c3f
Fix bugzilla 24583 - di generator emits return scope and scope return…
dkorpel Jun 18, 2024
7623de1
[dtemplate.d] use early return (dlang/dmd!16601)
thewilsonator Jun 20, 2024
2de2e08
Fix Bugzilla 12885 - const union wrongly converts implicitly to mutable
ntrel Jun 17, 2024
5ad1f56
add disasmarm.d for AArch64 disassembly (dlang/dmd!16600)
WalterBright Jun 20, 2024
80ff514
Mute noisy warnings (dlang/dmd!16605)
ryuukk Jun 21, 2024
6ff147d
Fix Bugzilla 24622 - Modify const data with void[] concatenation/appe…
ntrel Jun 21, 2024
72ab82a
Fix bugzilla issue 24623: Rename CppRuntime_Clang/Gcc to CppRuntime_l…
JohanEngelen Jun 22, 2024
242529b
fixup header files
JohanEngelen Jun 22, 2024
233d584
Fix d_do_test for older host compiler without this PR.
JohanEngelen Jun 22, 2024
6a92d84
Add visit for ClassReferenceExp to SemanticTimeTransitiveVisitor
dkorpel Jun 17, 2024
001b411
Merge pull request dlang/dmd!16610 from JohanEngelen/cppruntime_rename
dlang-bot Jun 22, 2024
f4326f0
Fix bugzilla 24594 - ImportC: Packed struct has wrong layout (dlang/d…
tim-dlang Jun 22, 2024
bb3fa74
Tweak message for unsafe cast to bool array/pointer
ntrel Jun 23, 2024
a0e36d3
Fix bugzilla 24626 - hasUDA does not handle multiple UDAs of the same…
0-v-0 Jun 24, 2024
0e2ea20
Move mtype.Type.size to typesem.d (dlang/dmd!16621)
RazvanN7 Jun 25, 2024
c59ca4e
Fix Bugzilla 24630 - Casting a bool pointer to a mutable pointer type…
ntrel Jun 25, 2024
5769706
refactor Import.overloadInsert
0-v-0 Jun 26, 2024
2c20204
Fix Bugzilla 24631 - Pointer cast allows changing @system field in @s…
ntrel Jun 26, 2024
b9eadbd
remove redundant `static` of enum
0-v-0 Jun 27, 2024
da63ca0
[trivial] Fix foreach range tuple element error message
ntrel Jun 28, 2024
0067237
refactor variable declarations to use `auto` (dlang/dmd!16632)
0-v-0 Jun 29, 2024
6a702eb
Fix bugzilla issue 24623 followup.
JohanEngelen Jun 22, 2024
c1c088a
Remove never used functions from unwind.d
JohanEngelen Jun 30, 2024
b8c51c7
Treat `import("file")` as hex string
dkorpel Jun 30, 2024
fdfddf6
reduce duplicative code (dlang/dmd!16640)
0-v-0 Jul 1, 2024
269c5fe
Merge remote-tracking branch 'upstream/stable' into merge_stable
ibuclaw Jul 1, 2024
ae1bf42
Extract mtype.Type.implicitConvTo and move it to dcast.d
RazvanN7 Jul 1, 2024
c6ae2c3
Merge pull request dlang/dmd!16642 from ibuclaw/merge_stable
dlang-bot Jul 1, 2024
f5caabb
Merge remote-tracking branch 'upstream/master' into stable
ibuclaw Jul 1, 2024
847bf9c
Document template instance duplication status as part of its field do…
rikkimax Jul 2, 2024
bc07096
Fix Bugzilla 24599 - Wrongly elided TypeInfo emission (dlang/dmd!15868)
kinke Jul 2, 2024
a0fa669
Merge remote-tracking branch 'origin/dmd-rewrite-stable' into merge-2…
kinke Jul 16, 2024
665e14a
Bump version, frontend version and Phobos
kinke Jul 16, 2024
c9ac30c
Adapt to free-standing `size(Type*)` function
kinke Jul 16, 2024
a5a7b6b
Adapt to free-standing `leastAsSpecialized()` function
kinke Jul 16, 2024
3b16b38
Misc. little merge fixes for compiler
kinke Jul 16, 2024
4a770ba
Adapt to renamed predefined CppRuntime_* versions
kinke Jul 16, 2024
13a0b70
Little Win32 mergefix for tests/dmd/runnable/test17559.d
kinke Jul 16, 2024
c271cf9
Merge remote-tracking branch 'origin/master' into merge-2.110
kinke Jul 19, 2024
31323df
[add changelog entry]
kinke Jul 19, 2024
a638c63
Fix bugzilla 24337 - Segfault when printing an int[] cast from a stri…
dkorpel Jul 22, 2024
591013f
Add BitFieldStyle.Gcc_Clang_ARM
kinke Jul 21, 2024
0356e22
[refactor to `TargetC.contributesToAggregateAlignment(BitFieldDeclara…
kinke Jul 22, 2024
05e779b
Merge remote-tracking branch 'origin/dmd-rewrite-stable' into merge-2…
kinke Aug 2, 2024
2844d52
Bump Phobos
kinke Aug 2, 2024
ff49df6
Implement new TargetC::contributesToAggregateAlignment() hook
kinke Aug 2, 2024
2463fe9
Merge remote-tracking branch 'origin/master' into merge-2.110
kinke Aug 2, 2024
958a415
Fix Bugzilla Issue 24687 - [REG2.110] Cannot cast string-imports to s…
RazvanN7 Aug 5, 2024
b9a82cb
Merge remote-tracking branch 'origin/dmd-rewrite-stable' into merge-2…
kinke Aug 10, 2024
2e6d917
Bump Phobos
kinke Aug 10, 2024
2c88914
Merge remote-tracking branch 'origin/master' into merge-2.110
kinke Aug 10, 2024
dd8d0e1
Bump bundled dlang tools / dub / reggae to preliminary versions
kinke Aug 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ packaging_steps_template: &PACKAGING_STEPS_TEMPLATE
# Build & copy reggae
build_reggae_script: |
cd $CIRRUS_WORKING_DIR/..
git clone --recursive https://github.com/atilaneves/reggae.git
git clone --recursive https://github.com/kinke/reggae.git
cd reggae
git checkout "$(cat $CIRRUS_WORKING_DIR/packaging/reggae_version)"
# needs rdmd in PATH
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/7-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ runs:
run: |
set -eux
cd ..
git clone --recursive https://github.com/atilaneves/reggae.git
git clone --recursive https://github.com/kinke/reggae.git
cd reggae
git checkout "$(cat ../ldc/packaging/reggae_version)"

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# LDC master

#### Big news
- Frontend, druntime and Phobos are at version [2.110.0](https://dlang.org/changelog/2.110.0.html). (#4707)
- LLVM for prebuilt packages bumped to v18.1.8 (incl. macOS arm64). (#4712)
- Android: NDK for prebuilt package bumped from r26d to r27. (#4711)
- ldc2.conf: %%ldcconfigpath%% placeholder added - specifies the directory where current configuration file is located. (#4717)
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ include(GetLinuxDistribution)
#

# Version information
set(LDC_VERSION "1.39.0") # May be overridden by git hash tag
set(LDC_VERSION "1.40.0") # May be overridden by git hash tag
set(DMDFE_MAJOR_VERSION 2)
set(DMDFE_MINOR_VERSION 109)
set(DMDFE_PATCH_VERSION 1)
set(DMDFE_MINOR_VERSION 110)
set(DMDFE_PATCH_VERSION 0)

set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION})

Expand Down
4 changes: 2 additions & 2 deletions dmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,9 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [libelf.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/libelf.d) | Library in ELF format (Unix) |
| [libmach.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/libmach.d) | Library in Mach-O format (macOS) |
| [libmscoff.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/libmscoff.d) | Library in COFF format (32/64-bit Windows) |
| [libomf.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/libomf.d) | Library in OMF format (legacy 32-bit Windows) |
| [scanelf.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/scanelf.d) | Extract symbol names from a library in ELF format |
| [scanmach.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/scanmach.d) | Extract symbol names from a library in Mach-O format |
| [scanmscoff.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/scanmscoff.d) | Extract symbol names from a library in COFF format |
| [scanomf.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/scanomf.d) | Extract symbol names from a library in OMF format |

### Code generation / back-end interfacing

Expand Down Expand Up @@ -253,6 +251,8 @@ Note that these groups have no strict meaning, the category assignments are a bi
| [hdrgen.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/hdrgen.d) | Convert an AST into D source code for `.di` header generation, as well as `-vcg-ast` and error messages |
| [json.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/json.d) | Describe the module in a `.json` file for the `-X` flag |
| [dtoh.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dtoh.d) | C++ header generation from D source files |
| [disasm86.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/disasm86.d) | x86-64 dissassembly generation
| [disasmarm.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/backend/arm/disasmarm.d) | AArch64 disassembly generation

### Utility

Expand Down
2 changes: 1 addition & 1 deletion dmd/aggregate.d
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import dmd.identifier;
import dmd.location;
import dmd.mtype;
import dmd.tokens;
import dmd.typesem : defaultInit, addMod;
import dmd.typesem : defaultInit, addMod, size;
import dmd.visitor;

/**
Expand Down
1 change: 1 addition & 0 deletions dmd/argtypes_aarch64.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module dmd.argtypes_aarch64;

import dmd.astenums;
import dmd.mtype;
import dmd.typesem;

/****************************************************
* This breaks a type down into 'simpler' types that can be passed to a function
Expand Down
1 change: 1 addition & 0 deletions dmd/argtypes_sysv_x64.d
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import dmd.astenums;
import dmd.declaration;
import dmd.globals;
import dmd.mtype;
import dmd.typesem;
import dmd.target;
import dmd.visitor;

Expand Down
1 change: 1 addition & 0 deletions dmd/argtypes_x86.d
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import dmd.declaration;
import dmd.globals;
import dmd.location;
import dmd.mtype;
import dmd.typesem;
import dmd.target;
import dmd.visitor;

Expand Down
1 change: 1 addition & 0 deletions dmd/arrayop.d
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module dmd.arrayop;
import core.stdc.stdio;
import dmd.arraytypes;
import dmd.astenums;
import dmd.dcast : implicitConvTo;
import dmd.declaration;
import dmd.dscope;
import dmd.dsymbol;
Expand Down
1 change: 1 addition & 0 deletions dmd/chkformat.d
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import dmd.globals;
import dmd.identifier;
import dmd.location;
import dmd.mtype;
import dmd.typesem;
import dmd.target;


Expand Down
17 changes: 8 additions & 9 deletions dmd/cli.d
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ dmd -cov -unittest myprog.d
Option("P=<preprocessorflag>",
"pass preprocessorflag to C preprocessor",
`Pass $(I preprocessorflag) to
$(WINDOWS sppn.exe or cl.exe)
$(WINDOWS cl.exe)
$(UNIX cpp)`,
),
Option("preview=<name>",
Expand Down Expand Up @@ -775,12 +775,11 @@ dmd -cov -unittest myprog.d
`darwin` or `osx` for MacOS, `dragonfly` or `dragonflybsd` for DragonflyBSD,
`freebsd`, `openbsd`, `linux`, `solaris` or `windows` for their respective operating systems.
$(I cenv) is the C runtime environment and is optional: `musl` for musl-libc,
`msvc` for the MSVC runtime (the default for windows with this option),
`bionic` for the Andriod libc, `digital_mars` for the Digital Mars runtime for Windows
`gnu` or `glibc` for the GCC C runtime, `newlib` or `uclibc` for their respective C runtimes.
($ I cppenv) is the C++ runtime environment: `clang` for the LLVM C++ runtime
`gcc` for GCC's C++ runtime, `msvc` for microsoft's MSVC C++ runtime (the default for windows with this switch),
`sun` for Sun's C++ runtime and `digital_mars` for the Digital Mars C++ runtime for windows.
`msvc` for the MSVC runtime, `bionic` for the Andriod libc, `gnu` or `glibc`
for the GCC C runtime, `newlib` or `uclibc` for their respective C runtimes.
($ I cppenv) is the C++ runtime environment: `clang` for the LLVM C++ runtime,
`gcc` for GCC's C++ runtime, `msvc` for microsoft's MSVC C++ runtime,
`sun` for Sun's C++ runtime.
"
),
Option("transition=<name>",
Expand Down Expand Up @@ -965,8 +964,8 @@ dmd -cov -unittest myprog.d
"allow use of => for methods and top-level functions in addition to lambdas",
"https://dlang.org/spec/function.html#ShortenedFunctionBody", false, true),
Feature("fixImmutableConv", "fixImmutableConv",
"disallow functions with a mutable `void[]` parameter to be strongly pure",
"https://dlang.org/changelog/2.101.0.html#dmd.fix-immutable-conv"),
"disallow `void[]` data from holding immutable data",
"https://dlang.org/changelog/2.101.0.html#dmd.fix-immutable-conv, https://issues.dlang.org/show_bug.cgi?id=17148"),
Feature("systemVariables", "systemVariables",
"disable access to variables marked '@system' from @safe code",
"https://dlang.org/spec/attribute.html#system-variables"),
Expand Down
10 changes: 5 additions & 5 deletions dmd/clone.d
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ StorageClass mergeFuncAttrs(StorageClass s1, const FuncDeclaration f) pure
return s1;
StorageClass s2 = (f.storage_class & STC.disable);

TypeFunction tf = cast(TypeFunction)f.type;
auto tf = cast(TypeFunction)f.type;
if (tf.trust == TRUST.safe)
s2 |= STC.safe;
else if (tf.trust == TRUST.system)
Expand Down Expand Up @@ -177,7 +177,7 @@ private bool needOpAssign(StructDeclaration sd)
Type tv = v.type.baseElemOf();
if (tv.ty == Tstruct)
{
TypeStruct ts = cast(TypeStruct)tv;
auto ts = cast(TypeStruct)tv;
if (ts.sym.isUnionDeclaration())
continue;
if (needOpAssign(ts.sym))
Expand Down Expand Up @@ -314,7 +314,7 @@ FuncDeclaration buildOpAssign(StructDeclaration sd, Scope* sc)
else if (sd.dtor)
{
//printf("\tswap copy\n");
TypeFunction tdtor = cast(TypeFunction)sd.dtor.type;
auto tdtor = cast(TypeFunction)sd.dtor.type;
assert(tdtor.ty == Tfunction);

auto idswap = Identifier.generateId("__swap");
Expand Down Expand Up @@ -435,7 +435,7 @@ bool needOpEquals(StructDeclaration sd)
auto tvbase = tv.baseElemOf();
if (tvbase.ty == Tstruct)
{
TypeStruct ts = cast(TypeStruct)tvbase;
auto ts = cast(TypeStruct)tvbase;
if (ts.sym.isUnionDeclaration() && ts.sym.fields.length != 1)
continue;
if (needOpEquals(ts.sym))
Expand Down Expand Up @@ -762,7 +762,7 @@ private bool needToHash(StructDeclaration sd)
auto tvbase = tv.baseElemOf();
if (tvbase.ty == Tstruct)
{
TypeStruct ts = cast(TypeStruct)tvbase;
auto ts = cast(TypeStruct)tvbase;
if (ts.sym.isUnionDeclaration())
continue;
if (needToHash(ts.sym))
Expand Down
1 change: 1 addition & 0 deletions dmd/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import dmd.globals;
import dmd.id;
import dmd.identifier;
import dmd.mtype;
import dmd.typesem;
import dmd.root.array;
import dmd.root.ctfloat;

Expand Down
4 changes: 2 additions & 2 deletions dmd/cond.d
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,9 @@ extern (C++) final class VersionCondition : DVCondition
case "AVR":
case "BigEndian":
case "BSD":
case "CppRuntime_Clang":
case "CppRuntime_LLVM":
case "CppRuntime_DigitalMars":
case "CppRuntime_Gcc":
case "CppRuntime_GNU":
case "CppRuntime_Microsoft":
case "CppRuntime_Sun":
case "CRuntime_Bionic":
Expand Down
2 changes: 1 addition & 1 deletion dmd/constfold.d
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import dmd.root.utf;
import dmd.sideeffect;
import dmd.target;
import dmd.tokens;
import dmd.typesem : toDsymbol, equivalent, sarrayOf;
import dmd.typesem : toDsymbol, equivalent, sarrayOf, size;

private enum LOG = false;

Expand Down
60 changes: 47 additions & 13 deletions dmd/cparse.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import dmd.root.array;
import dmd.common.outbuffer;
import dmd.root.rmem;
import dmd.tokens;
import dmd.typesem : size;

version (LDC) private enum LDC_pre_2084 = __VERSION__ < 2084; // workaround bug with LDC < v1.14 host compilers
else private enum LDC_pre_2084 = false;
Expand Down Expand Up @@ -1875,22 +1876,30 @@ final class CParser(AST) : Parser!AST
* init-declarator:
* declarator simple-asm-expr (opt) gnu-attributes (opt)
* declarator simple-asm-expr (opt) gnu-attributes (opt) = initializer
*
* Clang also allows simple-asm-expr after gnu-attributes.
*/
while (1)
{
if (token.value == TOK.asm_)
{
asmName = cparseGnuAsmLabel();
/* This is a data definition, there cannot now be a
* function definition.
*/
first = false;
}
else if (token.value == TOK.__attribute__)
cparseGnuAttributes(specifier);
else
break;
}

switch (token.value)
{
case TOK.assign:
case TOK.comma:
case TOK.semicolon:
case TOK.asm_:
case TOK.__attribute__:
if (token.value == TOK.asm_)
asmName = cparseGnuAsmLabel();
if (token.value == TOK.__attribute__)
{
cparseGnuAttributes(specifier);
if (token.value == TOK.leftCurly)
break; // function definition
}
/* This is a data definition, there cannot now be a
* function definition.
*/
Expand Down Expand Up @@ -3629,6 +3638,12 @@ final class CParser(AST) : Parser!AST
* type on the target machine. It's the opposite of __attribute__((packed))
*/
}
else if (token.ident == Id.packed)
{
specifier.packalign.set(1);
specifier.packalign.setPack(true);
nextToken();
}
else if (token.ident == Id.always_inline) // https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
{
specifier.scw |= SCW.xinline;
Expand Down Expand Up @@ -3977,7 +3992,7 @@ final class CParser(AST) : Parser!AST
members = new AST.Dsymbols(); // so `members` will be non-null even with 0 members
while (token.value != TOK.rightCurly)
{
cparseStructDeclaration(members);
cparseStructDeclaration(members, packalign);

if (token.value == TOK.endOfFile)
break;
Expand All @@ -3991,6 +4006,24 @@ final class CParser(AST) : Parser!AST
* struct-declarator (opt)
*/
}

/* GNU Extensions
* Parse the postfix gnu-attributes (opt)
*/
Specifier specifier;
if (token.value == TOK.__attribute__)
cparseGnuAttributes(specifier);
if (!specifier.packalign.isUnknown)
{
packalign.set(specifier.packalign.get());
packalign.setPack(specifier.packalign.isPack());
foreach (ref d; (*members)[])
{
auto decls = new AST.Dsymbols(1);
(*decls)[0] = d;
d = new AST.AlignDeclaration(d.loc, specifier.packalign, decls);
}
}
}
else if (!tag)
error("missing tag `identifier` after `%s`", Token.toChars(structOrUnion));
Expand Down Expand Up @@ -4022,8 +4055,9 @@ final class CParser(AST) : Parser!AST
* declarator (opt) : constant-expression
* Params:
* members = where to put the fields (members)
* packalign = alignment to use for struct members
*/
void cparseStructDeclaration(AST.Dsymbols* members)
void cparseStructDeclaration(AST.Dsymbols* members, structalign_t packalign)
{
//printf("cparseStructDeclaration()\n");
if (token.value == TOK._Static_assert)
Expand All @@ -4034,7 +4068,7 @@ final class CParser(AST) : Parser!AST
}

Specifier specifier;
specifier.packalign = this.packalign;
specifier.packalign = packalign.isUnknown ? this.packalign : packalign;
auto tspec = cparseSpecifierQualifierList(LVL.member, specifier);
if (!tspec)
{
Expand Down
2 changes: 1 addition & 1 deletion dmd/cppmangle.d
Original file line number Diff line number Diff line change
Expand Up @@ -2197,7 +2197,7 @@ private extern(C++) final class ComponentVisitor : Visitor
/// Set to the result of the comparison
private bool result;

public this(RootObject base) @safe
public this(RootObject base) @trusted
{
switch (base.dyncast())
{
Expand Down
Loading