Skip to content

Commit

Permalink
feat: Add support for C++ style forward declares.
Browse files Browse the repository at this point in the history
In cimple, `struct X;` will now mean the same as `typedef struct X X;`,
which is (roughly) the same behaviour as in C++. This is only to support
having plain `struct X;` declarations where we put our comments vs.
having the typedefs surrounded by ifdefs for C99 reasons (benign typedef
redefinitions are a C11 feature).
  • Loading branch information
iphydf committed Jan 24, 2025
1 parent 4168de6 commit 9fabfbd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
19 changes: 19 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
version: 2

workflows:
version: 2
circleci:
jobs:
- bazel-opt

jobs:
bazel-opt:
working_directory: /tmp/cirrus-ci-build
docker:
- image: toxchat/toktok-stack:latest-release

steps:
- checkout
- run: /src/workspace/tools/inject-repo hs-cimple
- run: cd /src/workspace && bazel test -k //hs-cimple/...
24 changes: 12 additions & 12 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
bazel-opt_task:
container:
image: toxchat/toktok-stack:latest-release
cpu: 2
memory: 6G
configure_script:
- /src/workspace/tools/inject-repo hs-cimple
test_all_script:
- cd /src/workspace && bazel test -k
--config=ci
//hs-cimple/...
# ---
# bazel-opt_task:
# container:
# image: toxchat/toktok-stack:latest-release
# cpu: 2
# memory: 6G
# configure_script:
# - /src/workspace/tools/inject-repo hs-cimple
# test_all_script:
# - cd /src/workspace && bazel test -k
# --config=ci
# //hs-cimple/...
5 changes: 4 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ load("//third_party/haskell/happy:build_defs.bzl", "happy_parser")
load("//third_party/haskell/hspec-discover:build_defs.bzl", "hspec_test")
load("//tools/project:build_defs.bzl", "project")

project(license = "gpl3-https")
project(
custom_cirrus = True,
license = "gpl3-https",
)

alex_lexer(
name = "Lexer",
Expand Down
1 change: 1 addition & 0 deletions src/Language/Cimple/Parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ TypedefDecl :: { NonTerm }
TypedefDecl
: typedef QualType ID_SUE_TYPE ';' { Fix $ Typedef $2 $3 }
| typedef FunctionPrototype(ID_FUNC_TYPE) ';' { Fix $ TypedefFunction $2 }
| struct ID_SUE_TYPE ';' { Fix $ Typedef (Fix (TyStruct $2)) $2 }

QualType :: { NonTerm }
QualType
Expand Down

0 comments on commit 9fabfbd

Please sign in to comment.