Skip to content

das_hash_map: drop redundant includes, fix EASTL/no-exception support#2716

Merged
borisbat merged 1 commit into
masterfrom
bbatkin/das-hash-map-prune-includes
May 18, 2026
Merged

das_hash_map: drop redundant includes, fix EASTL/no-exception support#2716
borisbat merged 1 commit into
masterfrom
bbatkin/das-hash-map-prune-includes

Conversation

@borisbat
Copy link
Copy Markdown
Collaborator

@borisbat borisbat commented May 18, 2026

Summary

Three issues in include/das_hash_map/das_hash_map.h:

1. 10 redundant #includes. The header is only ever pulled via das_config.h, which already includes <vector>, <utility>, <functional>, <string>, <type_traits>, <initializer_list> etc. before reaching us — so the local includes were dead weight in every TU.

2. using std::vector; / pair; / hash; / equal_to; / move; / forward; / forward_iterator_tag; block. Harmless in the default build, but actively wrong in the EASTL config (cmake/das_config_eastl/das_config.h does using namespace eastl;): those using-declarations would shadow eastl::* with std::* and defeat the abstraction. Switched all references to the das:: prefix throughout, which routes to either std:: or eastl:: depending on the active using namespace ... directive.

3. throw std::out_of_range(...) in at(). EASTL doesn't define eastl::out_of_range (it uses std::out_of_range directly throughout its own headers), and on libstdc++ <stdexcept> isn't transitively pulled by das_config.h's includes — CI was failing on this on both Linux jobs and the EASTL job. More importantly, games embedding daslang frequently disable C++ exceptions entirely, so a raw throw in a low-level header is the wrong primitive regardless. Switched to das::das_throw, which is daslang's own setjmp/longjmp panic mechanism. Required widening das_throw to be declared/defined unconditionally (it was previously gated on DAS_ENABLE_EXCEPTIONS=0):

  • das_config.h, das_config_eastl/das_config.h, include_fmt.h: move the void das_throw(const char *) declaration out of the DAS_ENABLE_EXCEPTIONS=0 #if. FMT_THROW macro stays conditional.
  • runtime_string.cpp: add an implementation for the DAS_ENABLE_EXCEPTIONS=1 case that routes through dasException, so catch(dasException&) handlers in simulate_exceptions.cpp pick up C++-side panics from low-level headers too.

Test plan

  • Default (libc++/std) full Release build: clean
  • ctest --test-dir build: 34/34 pass
  • EASTL config (-DDAS_CONFIG_INCLUDE_DIR=cmake/das_config_eastl against cloned EASTL + EABase): daslang target builds clean, binary runs and reports version
  • .gitignore: hide local-verify checkout dirs (eastl/, eabase/, build_eastl/)
  • CI green across all configs (Linux, EASTL, WASM, macOS, Windows)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 18, 2026 15:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up daslang_hash_map so it uses the das:: namespace abstraction instead of directly importing selected std:: names, improving compatibility with the EASTL configuration.

Changes:

  • Removed local standard-library includes from das_hash_map.h and documented reliance on das_config.h.
  • Replaced direct/unqualified standard-library type usage with das::-qualified equivalents.
  • Added local EASTL verification directories to .gitignore.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
include/das_hash_map/das_hash_map.h Routes hash map/set types and helpers through das:: namespace abstraction.
.gitignore Ignores local EASTL/EABase checkout and build directories.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/das_hash_map/das_hash_map.h Outdated
Three issues in include/das_hash_map/das_hash_map.h:

(1) 10 redundant #includes. The header is only ever pulled via
das_config.h, which already includes <vector>, <utility>, <functional>,
<string>, <type_traits>, <initializer_list> etc. before reaching us, so
the local includes were dead weight in every TU. Dropped.

(2) `using std::vector;` / `pair;` / `hash;` / `equal_to;` / `move;` /
`forward;` / `forward_iterator_tag;` block. Harmless in the default
build, but actively wrong in the EASTL config (das_config_eastl does
`using namespace eastl;`): those using-declarations would shadow
eastl::* with std::* and defeat the abstraction. Switched all
references to das:: prefix, which routes to std:: or eastl:: depending
on the active using-directive in the config.

(3) `throw std::out_of_range(...)` in at(). EASTL doesn't define
eastl::out_of_range (it uses std::out_of_range directly throughout its
own headers), and on libstdc++ <stdexcept> isn't transitively pulled by
das_config.h's includes — CI was failing on this on both Linux jobs and
the EASTL job. More importantly, games embedding daslang frequently
disable C++ exceptions entirely, so a raw `throw` in a low-level header
is the wrong primitive regardless. Switched to das::das_throw, which is
daslang's own setjmp/longjmp panic mechanism. Required widening
das_throw to be declared/defined unconditionally (it was previously
gated on DAS_ENABLE_EXCEPTIONS=0):

  - das_config.h, das_config_eastl/das_config.h, include_fmt.h: move
    the `void das_throw(const char *)` declaration out of the
    DAS_ENABLE_EXCEPTIONS=0 #if. FMT_THROW macro stays conditional.
  - runtime_string.cpp: add an implementation for the
    DAS_ENABLE_EXCEPTIONS=1 case that routes through dasException, so
    catch(dasException&) handlers in simulate_exceptions.cpp pick up
    C++-side panics from low-level headers too.

Verified:
- Default libc++/std: full Release build clean, ctest 34/34 pass
- EASTL (das_config_eastl + cloned EASTL/EABase): daslang target builds
  clean, binary runs and reports version

.gitignore: hide the local-verify checkout dirs (eastl/, eabase/,
build_eastl/).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@borisbat borisbat force-pushed the bbatkin/das-hash-map-prune-includes branch from 4617cd1 to 6183e3f Compare May 18, 2026 15:43
@borisbat borisbat changed the title das_hash_map: drop redundant includes + std-namespace using-block das_hash_map: drop redundant includes, fix EASTL/no-exception support May 18, 2026
@borisbat borisbat requested a review from Copilot May 18, 2026 15:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

@borisbat borisbat merged commit e74b4fd into master May 18, 2026
30 checks passed
borisbat added a commit that referenced this pull request May 18, 2026
…-and-macros-skill

docs: mouse cards from PRs #2712/#2714/#2716 + ExprVar._type pre-set guidance
pull Bot pushed a commit to forksnd/daScript that referenced this pull request May 18, 2026
Eight blind-mouse cache cards accumulated across PRs GaijinEntertainment#2712/GaijinEntertainment#2714 (linq_fold
work) and GaijinEntertainment#2716 (das_hash_map cleanup):

- das-namespace-abstraction-std-vs-eastl-swap — how das:: routes to std::
  or eastl:: via `namespace das { using namespace ...; }` in the two
  configs; why explicit `using std::vector` blocks inside `namespace das`
  are harmful for EASTL builds.
- das-throw-universal-panic-primitive-low-level-headers — das_throw is
  daslang's setjmp/longjmp panic primitive; embedded games disable C++
  exceptions, so raw `throw` is the wrong primitive in low-level headers.
  Captures the unconditional-declaration change from GaijinEntertainment#2716.
- daslang-eastl-config-local-build-setup — clone EASTL + EABase
  separately (no longer submoduled), cmake invocation, what to test, the
  common `error: no member named 'X' in namespace 'das'` failure mode.
- libstdcpp-vs-libcpp-transitive-stdexcept-asymmetry — why CI failed on
  Linux only on the first push of GaijinEntertainment#2716; libstdc++ doesn't pull
  <stdexcept> transitively via <vector>/<string>, libc++ does.
- github-pr-body-angle-brackets-stripped-in-backticks — GitHub strips
  <vector> inside backticks in PR body markdown; use `&lt;X&gt;`
  entities and re-read after every update.
- how-do-i-dedupe-a-select-projection-... — Phase 3d projection
  double-eval root cause and PR GaijinEntertainment#2714 fix.
- inlining-a-sort-comparator-key-body-... — both forms evaluate the key
  body twice per comparison; sort-cmp inlining saves dispatch only.
- qmacro-multi-arg-block-declaration-... — parser dup-check fires on
  `MACRO TAG` placeholder name before macro substitution can rename;
  PR GaijinEntertainment#2714 parser fix details.

skills/das_macros.md: add a section about pre-setting `_type` on emitted
ExprVar (and similar nodes) before they flow into typed positions —
captures the 30165 trap from PR GaijinEntertainment#2714's try_make_inline_cmp work, since
Expression::clone deep-copies _type faithfully and the typer's
generic-instantiation pass runs before local-variable-resolution.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants