Skip to content
This repository has been archived by the owner on Jun 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from Para-Lang/issue-67-implem
Browse files Browse the repository at this point in the history
Merging #67 issue implementation into `dev` to continue from `dev` onwards
  • Loading branch information
Luna-Klatzer authored Jan 24, 2022
2 parents 3176f28 + ea5a6e4 commit c0d30e6
Show file tree
Hide file tree
Showing 61 changed files with 3,516 additions and 2,630 deletions.
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
## Summary

<!---
Explain the reason for this pr, changes and solution briefly.
-->

## Introduced Changes

<!---
Please explain the introduced changes and how they matter
-->

## Is this PR related to an issue or problem

<!---
For example a github issue or a general problem
-->

## What was the root cause for the problem

<!---
Please explain the root cause of the problem. Remove if unnecessary
-->

## Does your new code introduce new warnings or errors? (At current state)

<!---
CodeQL, Tests and while running
-->

## Changelog

<!---
Changelog, which explains new additions or changes. Minor changes should only
be included if they matter or have a big influence on the code/project
-->

### Added

### Changed

### Removed
44 changes: 24 additions & 20 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
name: Codecov
on: [push]
on: [ push ]

jobs:
run:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [ ubuntu-latest ]
env:
OS: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Build GTest Tests
run: |
cmake .
cmake --build . --target runParacModulesTests -- -j 9
- name: Run C-Coverage
run: |
./tests/tests/runParacModulesTests
gcov -abcfu ./include/CMakeFiles/parac-modules.dir/*.gc*
tree .
- name: Upload C coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .
env_vars: OS
files: pbl-int.c.gcov,pbl-string.c.gcov,pbl-types.c.gcov,pbl-io.c.gcov,pbl-mem.c.gcov,pbl-main.c.gcov,pbl-function.c.gcov,pbl.c.gcov
verbose: true
- uses: actions/checkout@master
- name: Build GTest Tests
run: |
cmake .
cmake --build . --target runPblTests
- name: Run C-Coverage
run: |
./tests/runPblTests
- name: Generate coverage files
run: |
gcov -abcfu ./CMakeFiles/pbl.dir/**/*.gcda ./CMakeFiles/pbl.dir/**/*.gcno
- name: Run Tree to show directory structure
run: |
tree .
- name: Download Codecov Uploader
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
- name: Upload C coverage to Codecov
run: |
./codecov -v -F unittests -t ${{ secrets.CODECOV_TOKEN }} -s ./src/ -f ./src/**/*.gcov -n Github-Actions-Upload
28 changes: 13 additions & 15 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: "CodeQL"

on:
push:
branches: [ main ]
Expand All @@ -24,19 +23,18 @@ jobs:
language: [ 'cpp' ]

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
- name: Checkout repository
uses: actions/checkout@v2

- name: Build
run: |
cmake .
cmake --build . --target runParacModulesTests -- -j 9
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Build
run: |
cmake .
cmake --build . --target runPblTests
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
6 changes: 3 additions & 3 deletions .github/workflows/drmemory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
- name: Build Tests
run: |
cmake .
cmake --build . --target runParacModulesTests -- -j 9
cmake --build . --target runPblTests
- name: Run Tests
run: |
./tests/tests/runParacModulesTests
./tests/runPblTests
- name: Run DrMemory for Tests
run: |
./DrMemory-Linux-2.4.0-2/bin/drmemory -- ./tests/tests/runParacModulesTests
./DrMemory-Linux-2.4.0-2/bin/drmemory -- ./tests/runPblTests
35 changes: 35 additions & 0 deletions .github/workflows/gcc-compatibility-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: GCC Compatibility Checks
on:
push:
branches-ignore:
- '**-coverage-report'
pull_request:

jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# At the moment only >=8.0 are supported -> https://github.com/Para-C/Para-C/discussions/76
gcc-version: [ 8, 9, 10, 11, latest ]

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.gcc-version }}
platform: x64
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.17.x'
- name: Build Tests
run: |
cmake .
cmake --build . --target runPblTests
- name: Run Tests
run: |
./tests/runPblTests
34 changes: 34 additions & 0 deletions .github/workflows/mingw-compatibility-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: MinGW Compatibility Checks
on:
push:
branches-ignore:
- '**-coverage-report'
pull_request:

jobs:
run:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
# At the moment only >=7.0 are supported by setup-gcc
mingw-version: [ latest ]

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up MinGW-w64
uses: egor-tensin/setup-mingw@v1
with:
platform: x64
- name: Set up cmake
uses: jwlawson/actions-setup-cmake@v1.9
with:
cmake-version: '3.17.x'
- name: Build Tests
run: |
cmake . -G "MinGW Makefiles" -D CMAKE_C_COMPILER=gcc -D CMAKE_CXX_COMPILER=g++
cmake --build . --target runPblTests
- name: Run Tests
run: |
.\tests\runPblTests.exe
109 changes: 84 additions & 25 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,57 +1,116 @@
# Changelog

All notable changes to the Compiler will be documented in this file.
Note that these changes in this file are specifically for the Compiler.
The full summary will be in the CHANGELOG.md file the main folder
All notable changes to the Compiler will be documented in this file. Note that these changes in this file are
specifically for the Compiler. The full summary will be in the CHANGELOG.md file the main folder

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

*Note that Documentation changes should not appear here!*

## [Unreleased]

### Added
- `pbl-apply-macro.h` for defining a macro function, which allows for iterating through macro args and apply
another macro to them

- `pbl-apply-macro.h` for defining a macro function, which allows for iterating through macro args and apply another
macro to them.
- Macros `PBL_GET_FUNC_ARGS_IDENTIFIER`, `PBL_GET_FUNC_BASE_IDENTIFIER` and `PBL_GET_FUNC_OVERHEAD_IDENTIFIER` for
getting standardised macros
- `PBL_COUNT_VA_ARGS` for counting the amount of arguments passed to this specific macro
- `PBL_FUNC_ARG` for creating the effect of arguments being `NULL` per default
- `PBL_CREATE_FUNC_OVERHEAD` for creating overhead of a Para-C function, which can support default arguments and
struct-like initialisation
- `PBL_CALL_FUNC` for calling a Para-C function and properly handling it
getting standardised macros.
- `PBL_COUNT_VA_ARGS` for counting the amount of arguments passed to this specific macro.
- `PBL_FUNC_ARG` for creating the effect of arguments being `NULL` per default.
- `PBL_CREATE_FUNC_OVERHEAD` for creating overhead of a Para-C function, which can support default arguments and
struct-like initialisation.
- `PBL_CALL_FUNC` for calling a Para-C function and properly handling it.
- Header `pbl-advanced-mem.h` for exception-supported and advanced memory handling with Para-C types.
- Function `PblMallocUncollectable()` in `pbl-mem.h` for allocating a variable that will not be automatically collected
aka. will exist until the user deallocates it or the program ends. This will be used for global variables that are
used throughout the entire program, and are essential to running properly, which means they should not be checked for
Garbage Collection.
- New Macro for simplified cleanup attribute assignment: `PBL_CLEANUP(func)`
- Better Docstrings to:
- `PBL_CREATE_ADDRESS_COPY`
- `PBL_WRITE_BACK_ADDRESS_COPY`
- New macro `PBL_SIZEOF_ON_RUNTIME(var)` for dynamically fetching the size using `PblType_T.size`.
- New macro `PBL_VAL_REQ_ARG` for validating a required argument aka. it may not be null. This is to make the code more
verbose when handling Para-C functions.
- New IO functions `PblInput()`and `PblInputChar()`
- New type `PblPointer_T` with conversion function `PblGetPointerT(void* val, PblType_T* type)`
- Inclusion check for C++ to use the `c` prefix in inclusion for C++ to avoid warnings (e.g `#include <cstring>`
in C++ and `#include <string.h>` in C)
- New type `PblTypeList_T` for local file type and meta-data tracking, with the additional handling functions and
macros:
- `PblAddTypeToTypeList()` - Adds a new type to the local type list
- `PblCreateNewType()` - Allocates a new type in memory that may be used for type lists
- `PblInitTypeList()` - Initialises a local type list and creates the on-runtime constructor for allocating its
content
- `LOCAL_TYPE_LIST_CONSTRUCTOR` - Is replaced with a default constructor function signature for registering new types
at runtime
- `PBL_REGISTER_LOCAL_TYPE` - Registers a local type and adds it to the local type list. Has to be used inside of
`LOCAL_TYPE_LIST_CONSTRUCTOR` constructor function definitions
- `PBL_INIT_LOCAL_TYPE_LIST` - Creates and initialises the variables `LOCAL_TYPE_LIST` and
`LOCAL_TYPE_TRACKING_INITIALISED`, which are required for utilising type tracking inside a file

### Changed
- Disabled `pthreads.h` usage on Windows for gtest and enabled usage of WIN32 threads
- Updated macro `PBL_CALL_FUNC`, which handles now also the amount of args properly

- Entirely restructured the buildup, and now created separate folders for headers (`include`) and
source code (`src`), where also CMake has been restructured and simplified.
- Updated macro `PBL_CALL_FUNC`, which handles now also the amount of args properly.
- Renamed the following types:
- `PblTypeMeta_T` to `PblType_T`
- `PblMetaVarCtx_T` to `PblVarMetaData_T`
- Renamed the following macros:
- `PBL_GET_ACTUAL_TYPE_INSTANCE` to `PBL_ASSIGN_TO_VAR`
- `PBL_ALLOC_DECLARATION` to `PBL_DECLARE_VAR`
- `PBL_DEFINE_VAR` to `PBL_DEFINE_VAR`
- `PBL_ALLOC_ARRAY_DEFINITION` to `PBL_CREATE_NEW_ARRAY`
- `PBL_DECLARATION_CONSTRUCTOR` to `PBL_TYPE_DECLARATION_DEFAULT_CONSTRUCTOR`
- `PBL_DEFINITION_STRUCT_CONSTRUCTOR` to `PBL_TYPE_DEFINITION_DEFAULT_STRUCT_CONSTRUCTOR`
- `PBL_DEFINITION_SINGLE_CONSTRUCTOR` to `PBL_TYPE_DEFINITION_DEFAULT_SIMPLE_CONSTRUCTOR`
- `PBL_PASTE_ADDRESS_COPY` to `PBL_WRITE_BACK_ADDRESS_COPY`
- Replaced `size_t *size` property in `PblVarMetaData_T` and replaced it with `PblType_T *type`
- Renamed `PBL_SIZEOF` to `PBL_SIZEOF_USABLE`
- Renamed `PBL_C_BASE_EXCEPTION_CATCH_CONSTRUCTOR` to `PBL_BASE_CALL_AND_CATCH_EXCEPTION` (for native C functions) and
avoided code repetition by utilising the function in `PBL_CALL_FUNC_AND_CATCH` (for Para-C functions) as well.
- Changed handling of `PBL_SIZEOF_ON_RUNTIME` to utilise usable memory and renamed the macro to
`PBL_SIZEOF_USABLE_ON_RUNTIME`

### Removed
- Outdated macro `PBL_CALL_FUNC_WITH_META_CTX`, which is now replaced by `PBL_CALL_FUNC` as the general method to
call Para-C functions

- Outdated macro `PBL_CALL_FUNC_WITH_META_CTX`, which is now replaced by `PBL_CALL_FUNC` as the general method to call
Para-C functions
- Unneeded `PBL_DEFINITION_IF_VA_ARGS_CONSTRUCTOR` macro
- Parameter `type` in `PBL_WRITE_BACK_ADDRESS_COPY`, which was unnecessary, due to both variables already having been
defined.
- Unneeded `PblCleanupLocal()`, which was briefly defined in `pbl-mem.c`
- Unneeded default cleanups, which were replaced by optional opt-in cleanups on declaration / definition.

## [v0.1.dev6] - 2021-11-10

### Changed
- Made the PBL properly fetch-able for the build script `build.py` in [Para-C](https://github.com/Para-C/Para-C)

- Made the PBL properly fetch-able for the build script `build.py` in [Para-C](https://github.com/Para-C/Para-C)

## [v0.1.dev5] - 2021-11-09

### Added
- Base types in `pbl-types.h` that wrap the low-level C types, including conversion functions which allow simply one-line
conversion

- Base types in `pbl-types.h` that wrap the low-level C types, including conversion functions which allow simply
one-line conversion
- Proper meta-tracking for all Para-C types using `PblVarMeta_T`
- Default declaration and definition macros for all types in `libpbl`. These are defined using `_DeclDefault` and
`_DefDefault` for all types
- `PblStream_T` and `PblFile_T` implementation for stream handling
- `PblIOStream_T` and `PblIOFile_T` implementation for stream handling
- Specified Int Types in `pbl-int.h` that wrap the int types in `stdint.h`
- Meta handling for managing a function call context and Exception handling in `pbl-function.h`
- Fallback implementation for `__VA_EXT__`, which has been implemented since C++20 or C23, using `./modules/parac-modules/included/va-opt.h`
- Added `pbl-mem.h` for independent memory management and Garbage Collector implementation using [Boehm-Demers-Weiser Garbage Collector](https://github.com/ivmai/bdwgc)
- Meta handling for managing a function call context and Exception handling in `pbl-function.h`
- Fallback implementation for `__VA_EXT__`, which has been implemented since C++20 or C23,
using `./modules/parac-modules/included/va-opt.h`
- Added `pbl-mem.h` for independent memory management and Garbage Collector implementation
using [Boehm-Demers-Weiser Garbage Collector](https://github.com/ivmai/bdwgc)
- Handler macros `PBL_GET_ACTUAL_TYPE_INSTANCE` (getting type instance), `PBL_ALLOC_DECLARATION` (Para-C Declarations)
and `PBL_ALLOC_DEFINITION` (Para-C Definitions) which standardise the initialisation of Para-C values
and `PBL_DEFINE_VAR` (Para-C Definitions) which standardise the initialisation of Para-C values

[unreleased]: https://github.com/Para-C/Para-C-Base-Library/tree/dev

[v0.1.dev6]: https://github.com/Para-C/Para-C-Base-Library/compare/v0.1.dev5...v0.1.dev6

[v0.1.dev5]: https://github.com/Para-C/Para-C-Base-Library/tag/v0.1.dev5
Loading

0 comments on commit c0d30e6

Please sign in to comment.