From fad55f62e544089746537fa2b1a9579dedf9cd56 Mon Sep 17 00:00:00 2001 From: GrieferAtWork Date: Fri, 15 Mar 2024 12:46:17 +0100 Subject: [PATCH] Upgrade to latest version of deemon An fix problems related to changes to `final member` semantics --- kos/misc/libgen/checker/cparser.dee | 36 +++++------ kos/misc/libgen/checker/ctype.dee | 16 ++--- kos/misc/libgen/libkeymap/parser.dee | 1 - kos/misc/libmagic/libmagic.dee | 93 ++++++++++++++-------------- kos/misc/magicemulator/_common.dee | 6 +- kos/misc/make_toolchain.sh | 4 +- 6 files changed, 77 insertions(+), 79 deletions(-) diff --git a/kos/misc/libgen/checker/cparser.dee b/kos/misc/libgen/checker/cparser.dee index 62fbfa8b9f..5d183b1c01 100644 --- a/kos/misc/libgen/checker/cparser.dee +++ b/kos/misc/libgen/checker/cparser.dee @@ -42,43 +42,43 @@ class CParser { } @@Current filename (can be overwritten via directives) - public final member filename: string; + public final varying member filename: string; @@Set of warnings that are currently being ignored - private final member ignoredWarnings: {string...} = []; + private member ignoredWarnings: {string...} = []; @@When true, always extend the buffer (never clear it) - private final member peeking: bool = false; + private member peeking: bool = false; @@The currently loaded token - public final member tok: string = ""; + public final varying member tok: string = ""; @@Start of the currently loaded token (for @lc) - public final member tokStart: int = 0; + public final varying member tokStart: int = 0; @@Mapping of defined exception IDs to their resp. name - public final member exceptByCode: {int: string} = Dict(); + public final varying member exceptByCode: {int: string} = Dict(); @@Mapping of defined exception names to their resp. ID - public final member exceptByName: {string: int} = Dict(); + public final varying member exceptByName: {string: int} = Dict(); #define ParserBackup Tuple - private final member fp: File | none; - private final member buf: Bytes = none; - private final member bufPos: int = 0; - private final member bufLen: int = 0; + private member fp: File | none; + private member buf: Bytes = none; + private member bufPos: int = 0; + private member bufLen: int = 0; @@Starting line of @buf (1-based) - private final member bufStartLine: int = 1; + private member bufStartLine: int = 1; @@Starting column of @buf (1-based) - private final member bufStartCol: int = 1; + private member bufStartCol: int = 1; @@Stack for `#pragma GCC diagnostic push` - private final member ignoredWarningsStack: {{string...}...} = []; + private member ignoredWarningsStack: {{string...}...} = []; @@Override for where warnings should be printed at - private final member warnLocationOverride: {(string, int, int)...} = []; + private member warnLocationOverride: {(string, int, int)...} = []; public final function pushWarnLocationOverride(loc: (string, int, int)) { warnLocationOverride.append(loc); @@ -426,9 +426,9 @@ again: } @@Recursion counter for "{...}" pairs within an active static-if block - private final member staticIfRecursion: int = 0; - private final member staticIfDepth: int = 0; - private final member staticIfAllowed: bool = true; + private member staticIfRecursion: int = 0; + private member staticIfDepth: int = 0; + private member staticIfAllowed: bool = true; @@Advance to the next token public final function next(): string { diff --git a/kos/misc/libgen/checker/ctype.dee b/kos/misc/libgen/checker/ctype.dee index d89b3bb2ac..33b6cd5566 100644 --- a/kos/misc/libgen/checker/ctype.dee +++ b/kos/misc/libgen/checker/ctype.dee @@ -2093,14 +2093,14 @@ class CSymbolTemplate: CTypeRefTemplate { global CEnumClassType; class CNamespace { this = default; - public final member name: string; - public final member symbols: {string: CSymbol | CSymbolTemplate} | none = none; - public final member typedefs: {string: CTypeRef | CTypeRefTemplate} | none = none; - public final member namespaces: {string: CNamespace} | none = none; - public final member structSymbols: {string: CStructType} | none = none; - public final member unionSymbols: {string: CStructType} | none = none; - public final member enumSymbols: {string: CEnumType} | none = none; - public final member importedNamespaces: {CNamespace...} | none = none; + public final varying member name: string; + public final varying member symbols: {string: CSymbol | CSymbolTemplate} | none = none; + public final varying member typedefs: {string: CTypeRef | CTypeRefTemplate} | none = none; + public final varying member namespaces: {string: CNamespace} | none = none; + public final varying member structSymbols: {string: CStructType} | none = none; + public final varying member unionSymbols: {string: CStructType} | none = none; + public final varying member enumSymbols: {string: CEnumType} | none = none; + public final varying member importedNamespaces: {CNamespace...} | none = none; @@Only here so we don't need special handling when used as a @CScope public property symbolValues = { get() -> none; }; diff --git a/kos/misc/libgen/libkeymap/parser.dee b/kos/misc/libgen/libkeymap/parser.dee index aeafe33158..5bedabd7d7 100644 --- a/kos/misc/libgen/libkeymap/parser.dee +++ b/kos/misc/libgen/libkeymap/parser.dee @@ -69,7 +69,6 @@ import * from .linker; #include "../../../include/kos/keyboard.h" global final knownKeyNames: {string: int} = { - "KEY_ESC" : KEY_ESC, "KEY_1" : KEY_1, "KEY_2" : KEY_2, diff --git a/kos/misc/libmagic/libmagic.dee b/kos/misc/libmagic/libmagic.dee index af82cd4a22..911eaff2a9 100644 --- a/kos/misc/libmagic/libmagic.dee +++ b/kos/misc/libmagic/libmagic.dee @@ -261,7 +261,7 @@ function fileMayHaveChanged(filename: string) { @@Selection for @Step.getRequiredFiles that refers to one file of many -class FirstFileOf { +final class FirstFileOf { this = default; public final member files: {string...}; } @@ -278,30 +278,30 @@ class Step { operator repr() -> name; @@The name of this step (Only for logs; no syntactical meaning) - final member name: string; + final varying member name: string; @@> run(step: BoundStep): {Waitable...} @@Execute the step and produce waitables - final member run: Callable; + final varying member run: Callable; @@> tostr(step: BoundStep): string @@Return a suitable, human-readable description for what this step does - final member tostr: Callable = none; + final varying member tostr: Callable = none; @@Set of group options used by this step - final member options: {string...} = none; + final varying member options: {string...} = none; @@> split(step: BoundStep): {BoundStep...} @@Split this step into multiple, smaller steps - final member split: Callable = none; + final varying member split: Callable = none; @@> getRequiredFiles(step: BoundStep): {string | FirstFileOf...} @@Returns a List of required files - final member getRequiredFiles: Callable = none; /* in */ + final varying member getRequiredFiles: Callable = none; /* in */ @@> getProducedFiles(step: BoundStep): {string...} @@Returns a List of produced files - final member getProducedFiles: Callable = none; /* out */ + final varying member getProducedFiles: Callable = none; /* out */ @@> getProducedOutputFiles(step: BoundStep): {string...} @@Returns the filenames of the primary output files, that is @@ -311,7 +311,7 @@ class Step { @@also be produced by this build step are considered secondary @@build artifacts who's timestamp will be ignored, except when @@explicitly used as dependencies of other steps. - final member getProducedOutputFiles: Callable = none; /* out */ + final varying member getProducedOutputFiles: Callable = none; /* out */ @@> getModifiedOutputFiles(step: BoundStep): {string...} @@Returns the names of output files that (may) be modified or @@ -323,14 +323,14 @@ class Step { @@ output file, that step is always executed first, allowing @@ it to create the output file before steps that may modify @@ it are then executed one by one. - final member getModifiedOutputFiles: Callable = none; /* in|out */ + final varying member getModifiedOutputFiles: Callable = none; /* in|out */ @@> getMaybeModifiedOutputFiles(step: BoundStep): {string...} @@Same as `getModifiedOutputFiles()', but the enumerated files may @@not necessarily get modified when the step is run. - Instead of using @@the timestamp of the file itself, use a different file `..latest' @@to keep track of the timestamp when such a file was last updated. - final member getMaybeModifiedOutputFiles: Callable = none; /* in|out */ + final varying member getMaybeModifiedOutputFiles: Callable = none; /* in|out */ final function withRequiredFiles(files: {string...}): Step { @@ -350,26 +350,26 @@ class Step { } -class Group { +final class Group { this = default; @@The name of this group (Only for logs; no syntactical meaning) - public final member name: string; + public final varying member name: string; @@List of compilation steps, which are functions invoked @@as Callable(group: Group, changed: bool): {Waitable...} @@The given parameter `changed' is set to true for the first @@step, as well as any step performed after a previous step @@returned at least 1 Waitable Object - public final member steps: {Step...} = []; + public final varying member steps: {Step...} = []; @@Group-specific options (for use by step callbacks) - public final member options: {string: Object} = Dict(); + public final varying member options: {string: Object} = Dict(); @@The path in which this group is defined - public final member defPath: string = ""; + public final varying member defPath: string = ""; - public final function getDependencies(toolchain: Toolchain): {string | FirstFileOf...} { + public function getDependencies(toolchain: Toolchain): {string | FirstFileOf...} { for (local s: steps) { local bss = BoundStep(this, s, toolchain); if (s.split !is none) { @@ -382,7 +382,7 @@ class Group { } } - private member _wildcardEnumerationCache: {string: {string...}} = Dict(); + private final member _wildcardEnumerationCache: {string: {string...}} = Dict(); function fixFilename(filename: string): string { if (filename.startswith("/")) @@ -498,35 +498,35 @@ class Configuration { @@Build configuration controller -class Config { +final class Config { this = default; @@The prefix that should be used by a cross-compiler (needs @@to be used in conjunction with the implementing toolchain) - public final member CROSS_PREFIX: string = ""; + public final varying member CROSS_PREFIX: string = ""; @@Set to the location of where build artifacts should be placed - public final member BUILD_PATH: string = "build"; + public final varying member BUILD_PATH: string = "build"; @@The default file extension for produced libraries #ifdef __WINDOWS__ - public final member LIBRARY_SUFFIX: string = ".dll"; + public final varying member LIBRARY_SUFFIX: string = ".dll"; #else /* __WINDOWS__ */ - public final member LIBRARY_SUFFIX: string = ".so"; + public final varying member LIBRARY_SUFFIX: string = ".so"; #endif /* !__WINDOWS__ */ @@Set to true if a re-build of all steps should be forced - public final member FORCE: bool = false; + public final varying member FORCE: bool = false; @@Set to true if error messages printed by build-tools @@should be formatted into a singular, common format. - public final member FORMAT_ERRORS: bool = false; + public final varying member FORMAT_ERRORS: bool = false; @@Enable verbose mode (print executed commands) - public final member VERBOSE: bool = false; + public final varying member VERBOSE: bool = false; @@Extra hooks for configuration-specific compile/link overrides - public final member CONFIG: Configuration = none; + public final varying member CONFIG: Configuration = none; @@Return the location of a some build artifact final function getBuildArtifact(group: Group, srcFile: string, ext: string): string { @@ -563,9 +563,8 @@ function tryJoinProcess(p: ipc.Process): bool { return true; } -class WaitableJoin: Waitable { - - private member obj: ipc.Process | Thread | Object; +final class WaitableJoin: Waitable { + private final member obj: ipc.Process | Thread | Object; this(obj) { this.obj = obj; @@ -593,19 +592,19 @@ class WaitableJoin: Waitable { class Toolchain { this = default; - member config: Config; + public final varying member config: Config; @@Name of the toolchain (for logs; if @none, then it isn't used) - member name: string = none; + public final varying member name: string = none; @@Storage for toolchain extension configurations (e.g. mtools) - member options: { string: Object } = Dict(); + public final varying member options: { string: Object } = Dict(); } -class BoundStep { +final class BoundStep { this = default; operator str(): string { if (step.tostr !is none) @@ -623,16 +622,16 @@ class BoundStep { } @@The bound group - public final member group: Group; + public final varying member group: Group; @@The bound step - public final member step: Step; + public final varying member step: Step; @@The used toolchain - public final member toolchain: Toolchain; + public final varying member toolchain: Toolchain; @@Step-specific data - public final member userData: Object; + public final varying member userData: Object; @@List of required input files public final property requiredFiles: {string | FirstFileOf...} = { @@ -791,7 +790,7 @@ class BoundStep { } #ifdef CACHE_ALL_MODIFIED_OUTPUT_FILES - private final member _allModifiedOutputFiles: {(string, int | none)...}; + private member _allModifiedOutputFiles: {(string, int | none)...}; public final property allModifiedOutputFiles: {(string, int | none)...} = { get(): {(string, int | none)...} { if (_allModifiedOutputFiles !is bound) { @@ -910,22 +909,22 @@ class BoundStep { } @@Waitables that need to complete before this step can be finished - private final member _stepWaitables: {Waitable...}; + private member _stepWaitables: {Waitable...}; @@Cache for @this.requiredFiles - private final member _requiredFiles: {string | FirstFileOf...}; + private member _requiredFiles: {string | FirstFileOf...}; @@Cache for @this.producedFiles - private final member _producedFiles: {string...}; + private member _producedFiles: {string...}; @@Cache for @this.producedOutputFiles - private final member _producedOutputFiles: {string...}; + private member _producedOutputFiles: {string...}; @@Cache for @this.modifiedOutputFiles - private final member _modifiedOutputFiles: {(string, int | none)...}; + private member _modifiedOutputFiles: {(string, int | none)...}; @@Cache for @this.maybeModifiedOutputFiles - private final member _maybeModifiedOutputFiles: {(string, int | none)...}; + private member _maybeModifiedOutputFiles: {(string, int | none)...}; operator == (other) -> this === other; operator != (other) -> this !== other; @@ -1454,9 +1453,9 @@ again_search_fin_steps: #if 0 -class Timed { +final class Timed { this = default; - public member name: string = "Unnamed"; + public final member name: string = "Unnamed"; private member start; operator enter() { start = tick(); diff --git a/kos/misc/magicemulator/_common.dee b/kos/misc/magicemulator/_common.dee index 08da38f350..716e18e291 100644 --- a/kos/misc/magicemulator/_common.dee +++ b/kos/misc/magicemulator/_common.dee @@ -113,9 +113,9 @@ function normalizeFilenameForLog(filename: string | Bytes): string { class Addr2line { - private final member proc: ipc.Process; - private final member reader: File; - private final member writer: File; + private member proc: ipc.Process; + private member reader: File; + private member writer: File; this(config: Config, hostFile: string) { local addr2lineExe = config.CROSS_PREFIX + "addr2line"; diff --git a/kos/misc/make_toolchain.sh b/kos/misc/make_toolchain.sh index 4c5aa45251..bcc4fa1f1a 100644 --- a/kos/misc/make_toolchain.sh +++ b/kos/misc/make_toolchain.sh @@ -32,8 +32,8 @@ # Don't use the latest patch, but this very specific one that # should be usable to drive the entirety of the KOS toolchain. -# v -- "Fix bad exception handler in `Mapping.popitem()`" -DEEMON_VERSION="4f35e172e321c9a16e99575eeda3e5726d5bd1a5" +# v -- "Change semantics of `final` members in user-classes" +DEEMON_VERSION="e4753f4df7825540c7908c730d2d9b8d130d619b" MAKE_PARALLEL_COUNT="$(grep -c ^processor /proc/cpuinfo)"