Skip to content

Commit

Permalink
Merge branch 'release/0.14.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vector-of-bool committed Apr 2, 2024
2 parents b6c38c8 + 8a3592b commit 5597b7b
Show file tree
Hide file tree
Showing 90 changed files with 27,854 additions and 1,327 deletions.
51 changes: 41 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,70 @@ name: Build and Test
on: [push, pull_request]

jobs:
build-gcc13:
name: Build for GCC 13.2
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-gcc --gcc_version=13.2

build-gcc12:
name: Build for GCC 12.2
name: Build for GCC 12.3
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-gcc-12.2
run: bash tools/earthly.sh +build-gcc --gcc_version=12.3

build-gcc11:
name: Build for GCC 11.2
name: Build for GCC 11.4
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-gcc-11.2
run: bash tools/earthly.sh +build-gcc --gcc_version=11.4

build-gcc10:
name: Build for GCC 10.3
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-gcc-10.3

# XXX: BROKEN due to compiler bugs. Investigate at a later date.
build-clang16:
name: Build for Clang 16 [Compiler bugs]
runs-on: ubuntu-latest
if: ${{false}} # Skipped
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-clang-16

build-clang17:
name: Build for Clang 17 [Compiler bugs]
runs-on: ubuntu-latest
if: ${{false}} # Skipped
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and Test
run: bash tools/earthly.sh +build-clang-17

build-vs2019:
name: Build for VS 2019
name: Build for VS 2019 [Compiler bugs]
runs-on: windows-2019
if: ${{false}} # Skipped
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and Test
run: tools/build-vs2019e.bat -Toolchain tools/msvc.jsonc

Expand All @@ -43,6 +74,6 @@ jobs:
runs-on: windows-2022
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Build and Test
run: tools/build-vs2022e.bat -Toolchain tools/msvc.jsonc
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
_build/
.vscode/
.vscode/
.cache/
127 changes: 77 additions & 50 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION 0.6
VERSION --pass-args --arg-scope-and-set 0.7

bpt-linux:
FROM alpine:3.16
Expand All @@ -10,90 +10,117 @@ bpt-linux:

BUILD:
COMMAND
ARG --required toolchain
COPY --dir src/ tools/ conf/ bpt.yaml /s
COPY +bpt-linux/bpt /usr/local/bin/bpt
WORKDIR /s
RUN --mount=type=cache,target=/root/.ccache \
bpt build --toolchain=/toolchain.yaml --tweaks-dir=conf
RUN --mount=type=cache,target=/root/.ccache,sharing=shared \
bpt build --toolchain=$toolchain --tweaks-dir=conf

PREP_GCC:
PREP_GCC_TOOLCHAIN:
COMMAND
RUN apk add gcc g++
ARG runtime_debug=true
ARG cxx_flags
RUN jq -n \
--arg cxx_flags "$cxx_flags -fconcepts-diagnostics-depth=10" \
--argjson runtime_debug "$runtime_debug" \
'{ \
compiler_id: "gnu", \
cxx_version: "c++20", \
cxx_flags: $cxx_flags, \
debug: true, \
runtime: {debug: $runtime_debug}, \
warning_flags: ["-Werror", "-Wsign-compare"], \
compiler_launcher: "ccache", \
}' \
| tee /toolchain.yaml
--arg cxx_flags "$cxx_flags -fconcepts-diagnostics-depth=10" \
--argjson runtime_debug "$runtime_debug" \
'{ \
compiler_id: "gnu", \
cxx_version: "c++20", \
cxx_flags: $cxx_flags, \
debug: true, \
runtime: {debug: $runtime_debug}, \
warning_flags: ["-Werror", "-Wsign-compare"], \
link_flags: ["-fuse-ld=lld"], \
compiler_launcher: "ccache", \
}' > /toolchain.yaml && \
echo "Using the following toolchain:" && \
cat /toolchain.yaml

PREP_CLANG:
ALPINE_PREP_GCC:
COMMAND
RUN apk add gcc g++
DO --pass-args +PREP_GCC_TOOLCHAIN

ALPINE_PREP_CLANG:
COMMAND
ARG apk_install=true
RUN ! "$apk_install" || apk add clang g++
DO --pass-args +PREP_CLANG_TOOLCHAIN

PREP_CLANG_TOOLCHAIN:
COMMAND
ARG runtime_debug=true
ARG cxx_flags
RUN jq -n \
--arg cxx_flags "$cxx_flags" \
--argjson runtime_debug "$runtime_debug" \
'{ \
compiler_id: "clang", \
cxx_version: "c++2b", \
cxx_flags: $cxx_flags, \
debug: true, \
runtime: {debug: $runtime_debug}, \
warning_flags: ["-Werror", "-Wsign-compare"], \
compiler_launcher: "ccache", \
}' \
| tee /toolchain.yaml
--arg cxx_flags "$cxx_flags" \
--argjson runtime_debug "$runtime_debug" \
'{ \
compiler_id: "clang", \
cxx_version: "c++2b", \
cxx_flags: $cxx_flags, \
debug: true, \
runtime: {debug: $runtime_debug}, \
warning_flags: ["-Werror", "-Wsign-compare"], \
link_flags: ["-fuse-ld=lld"], \
compiler_launcher: "ccache", \
}' > /toolchain.yaml && \
echo "Using the following toolchain:" && \
cat /toolchain.yaml

ALPINE_BUILD:
COMMAND
ARG --required version
FROM alpine:$version
RUN apk add jq musl-dev ccache
RUN apk add jq musl-dev ccache lld
ARG --required prep
ARG cxx_flags
ARG runtime_debug=true
DO +$prep --cxx_flags=$cxx_flags --runtime_debug=$runtime_debug
DO +BUILD

build-gcc-12.2:
DO +ALPINE_BUILD --version=3.17 --prep=PREP_GCC
DO --pass-args +$prep
DO +BUILD --toolchain=/toolchain.yaml

build-gcc-11.2:
DO +ALPINE_BUILD --version=3.16 --prep=PREP_GCC
build-gcc:
ARG --required gcc_version
FROM docker.io/library/gcc:$gcc_version
RUN apt-get update && apt-get install -y ccache lld jq
DO --pass-args +PREP_GCC_TOOLCHAIN
DO --pass-args +BUILD --toolchain=/toolchain.yaml

build-gcc-10.3:
DO +ALPINE_BUILD --version=3.15 --prep=PREP_GCC --cxx_flags="-fcoroutines" --runtime_debug=false
DO +ALPINE_BUILD --version=3.15 --prep=ALPINE_PREP_GCC --cxx_flags="-fcoroutines" --runtime_debug=false

build-clang-17:
DO +ALPINE_BUILD --version=3.19 --prep=ALPINE_PREP_CLANG

build-clang-16:
DO +ALPINE_BUILD --version=3.18 --prep=ALPINE_PREP_CLANG

build-clang-15:
DO +ALPINE_BUILD --version=3.17 --prep=PREP_CLANG
# XXX: Currently broken!
DO +ALPINE_BUILD --version=3.17 --prep=ALPINE_PREP_CLANG

build-clang-latest:
build-clang-snapshot:
# Use Ubuntu for this one, since LLVM ships binaries in their APT repo
FROM ubuntu:22.04
RUN apt-get update && \
apt-get -y install curl software-properties-common gpg jq ccache
LET ubuntu_codename=$(cat /etc/os-release | grep UBUNTU_CODENAME | sed 's/.*=//')
RUN curl -Ls https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy main"
RUN apt-get update && apt-get -y install clang-16
add-apt-repository "deb http://apt.llvm.org/$ubuntu_codename/ llvm-toolchain-$ubuntu_codename main"
LET snapshot_version=18
RUN apt-get update && apt-get -y install clang-$snapshot_version lld-$snapshot_version
# Link the names so bpt can find them without more toolchain tweaks
RUN ln -s /usr/bin/clang-16 /usr/local/bin/clang && \
ln -s /usr/bin/clang++-16 /usr/local/bin/clang++
DO +PREP_CLANG --apk_install=false
DO +BUILD
RUN ln -s /usr/bin/clang-$snapshot_version /usr/local/bin/clang && \
ln -s /usr/bin/clang++-$snapshot_version /usr/local/bin/clang++ && \
ln -s /usr/bin/ld.lld-$snapshot_version /usr/local/bin/ld.lld
DO --pass-args +PREP_CLANG_TOOLCHAIN
DO +BUILD --toolchain=/toolchain.yaml

build-gcc-multi:
build-all:
# NOTE: This could use a LOT of CPU! There's no task coordination here!
BUILD +build-gcc-12.2
BUILD +build-gcc-11.2
BUILD +build-gcc-10.3
BUILD +build-gcc \
--gcc_version=13.2 \
--gcc_version=12.3 \
--gcc_version=11.4
BUILD +build-clang-16
2 changes: 1 addition & 1 deletion bpt.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: neo-fun
version: 0.13.1
version: 0.14.0
test-dependencies:
- [email protected] using main
readme: README.md
Expand Down
47 changes: 47 additions & 0 deletions render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# /// script
# requires-python = ">=3.8"
# dependencies = []
# "jinja2",
# ]
# ///
import sys
from typing import Any, Sequence
import jinja2
import argparse


def format_each(iterable: Any, s: str) -> Any:
return (s.format(x) for x in iterable)


_GENERATED_FILE_WARNING = """// d8888b. .d88b. d8b db .d88b. d888888b d88888b d8888b. d888888b d888888b
// 88 `8D .8P Y8. 888o 88 .8P Y8. `~~88~~' 88' 88 `8D `88' `~~88~~'
// 88 88 88 88 88V8o 88 88 88 88 88ooooo 88 88 88 88
// 88 88 88 88 88 V8o88 88 88 88 88~~~~~ 88 88 88 88
// 88 .8D `8b d8' 88 V888 `8b d8' 88 88. 88 .8D .88. 88
// Y8888D' `Y88P' VP V8P `Y88P' YP Y88888P Y8888D' Y888888P YP"""


def gen_warning(filename: str) -> str:
return f"{_GENERATED_FILE_WARNING}\n\n// This file was GENERATED from {filename}"


def main(argv: Sequence[str]) -> int:
parser = argparse.ArgumentParser(
description="Renders a Jinja template from stdin to stdout"
)
parser.parse_args(argv) # No arguments, but throws if arguments are provided
template_str = sys.stdin.read()
env = jinja2.Environment(
line_statement_prefix="#%",
line_comment_prefix="##",
)
env.filters["format_each"] = format_each # type: ignore
tmpl = env.from_string(template_str)
s = tmpl.render(generated_file_notice=gen_warning)
sys.stdout.write(s)
return 0


if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))
16 changes: 3 additions & 13 deletions src/neo/addressof.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@

#include "./attrib.hpp"

// clang-format off
#if (NEO_HAS_BUILTIN(__builtin_addressof) || defined(_MSC_VER))
#define HAS_ADDROF_INTRIN 1
#endif
// clang-format on

#ifndef HAS_ADDROF_INTRIN
#if !NEO_HAS_BUILTIN(__builtin_addressof)
#include <memory>
#endif

Expand All @@ -20,7 +14,7 @@ namespace neo {
*/
template <typename T>
constexpr T* addressof(T& arg) noexcept {
#if HAS_ADDROF_INTRIN
#if NEO_HAS_BUILTIN(__builtin_addressof)
return __builtin_addressof(arg);
#else
return std::addressof(arg);
Expand All @@ -30,14 +24,10 @@ constexpr T* addressof(T& arg) noexcept {
template <typename T>
const T& addressof(const T&&) = delete;

#if HAS_ADDROF_INTRIN
#if NEO_HAS_BUILTIN(__builtin_addressof)
#define NEO_ADDRESSOF(X) __builtin_addressof((X))
#else
#define NEO_ADDRESSOF(X) std::addressof((X))
#endif

} // namespace neo

#ifdef HAS_ADDROF_INTRIN
#undef HAS_ADDROF_INTRIN
#endif
Loading

0 comments on commit 5597b7b

Please sign in to comment.