Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-old-style-cast'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unreachable-code-return'
build:c-as-cpp --per_file_copt='//c-toxcore[:/]@-Wno-unused-macros'

# Use _Nullable and _Nonnull on toxcore.
build --per_file_copt='//c-toxcore[:/]@-Wno-nullability-extension'
build --per_file_copt='//c-toxcore[:/]@-Wno-nullable-to-nonnull-conversion'

# Cyclone.
build --host_per_file_copt='//cyclone[:/]@-w'
build --per_file_copt='//cyclone/stage0[:/]@-w'
Expand Down
5 changes: 5 additions & 0 deletions .restyled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ exclude:
- "third_party/libzmq/**/*.hpp"
- "third_party/ncurses/src/**/*"
- "third_party/opus/**/*.h"

restylers:
- pyment:
enabled: false
- "*"
5 changes: 4 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,10 @@ http_archive(
build_file = "@toktok//third_party:ncurses.BUILD",
integrity = "sha256-E22RvCaamleF5fnpgLx2q1dCj2BM4+WlqQzrx2eXHMY=",
strip_prefix = "ncurses-6.5",
urls = ["https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz"],
urls = [
"https://invisible-island.net/archives/ncurses/ncurses-6.5.tar.gz",
"https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.5.tar.gz",
],
)

http_archive(
Expand Down
2 changes: 1 addition & 1 deletion c-toxcore
Submodule c-toxcore updated 194 files
2 changes: 2 additions & 0 deletions cspell.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ words:
- buildx
- ccache
- choco
- cimple
- citri
- codesign
- createdmg
Expand Down Expand Up @@ -54,6 +55,7 @@ words:
- srcs
- startswith
- teehee
- tokstyle
- toktok
- toplevel
- toxchat
Expand Down
2 changes: 1 addition & 1 deletion hs-tokstyle
Submodule hs-tokstyle updated 44 files
+12 −2 BUILD.bazel
+20 −22 doc/cimple.md
+117 −0 src/Tokstyle/Analysis/CallGraph.hs
+14 −0 src/Tokstyle/Analysis/Context.hs
+544 −0 src/Tokstyle/Analysis/DataFlow.hs
+1,196 −0 src/Tokstyle/Analysis/PointsTo.hs
+304 −0 src/Tokstyle/Analysis/Scope.hs
+992 −0 src/Tokstyle/Analysis/SecurityRank.hs
+121 −0 src/Tokstyle/Analysis/SecurityRank/Annotations.hs
+39 −0 src/Tokstyle/Analysis/SecurityRank/Lattice.hs
+29 −0 src/Tokstyle/Analysis/SecurityRank/Types.hs
+111 −0 src/Tokstyle/Analysis/Types.hs
+3 −3 src/Tokstyle/C/Linter/BoolConversion.hs
+64 −40 src/Tokstyle/C/Linter/Cast.hs
+6 −4 src/Tokstyle/Linter.hs
+1 −0 src/Tokstyle/Linter/FuncScopes.hs
+0 −124 src/Tokstyle/Linter/MissingNonNull.hs
+0 −172 src/Tokstyle/Linter/NonNull.hs
+306 −0 src/Tokstyle/Linter/Nullability.hs
+115 −0 src/Tokstyle/Linter/PointsTo.hs
+80 −0 src/Tokstyle/Linter/SecurityRank.hs
+860 −468 src/Tokstyle/Linter/TypeCheck.hs
+37 −0 src/Tokstyle/Worklist.hs
+1 −1 stack.yaml
+155 −0 test/Tokstyle/Analysis/AnnotationsSpec.hs
+207 −0 test/Tokstyle/Analysis/CallGraphSpec.hs
+28 −0 test/Tokstyle/Analysis/ContextSpec.hs
+792 −0 test/Tokstyle/Analysis/DataFlowSpec.hs
+70 −0 test/Tokstyle/Analysis/LatticeSpec.hs
+620 −0 test/Tokstyle/Analysis/PointsToSpec.hs
+332 −0 test/Tokstyle/Analysis/ScopeSpec.hs
+71 −0 test/Tokstyle/Analysis/SecurityRankSpec.hs
+93 −0 test/Tokstyle/C/Linter/BoolConversionSpec.hs
+231 −0 test/Tokstyle/C/Linter/CastSpec.hs
+43 −0 test/Tokstyle/C/Linter/ConversionSpec.hs
+2 −3 test/Tokstyle/Linter/DocCommentsSpec.hs
+0 −46 test/Tokstyle/Linter/MissingNonNullSpec.hs
+0 −124 test/Tokstyle/Linter/NonNullSpec.hs
+180 −0 test/Tokstyle/Linter/NullabilitySpec.hs
+317 −0 test/Tokstyle/Linter/PointsToSpec.hs
+1,531 −0 test/Tokstyle/Linter/SecurityRankSpec.hs
+662 −12 test/Tokstyle/Linter/TypeCheckSpec.hs
+22 −3 tokstyle.cabal
+4 −0 tools/check-cimple.hs
44 changes: 23 additions & 21 deletions tools/project/cabal_test
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ def parse_bazel(build: str) -> PackageData:
and stmt.value.func.id in ("haskell_library", "hspec_test")):
section: Dict[str, Union[str, List[str]]] = {}
for arg in stmt.value.keywords:
if arg.arg == "name" and isinstance(arg.value, ast.Str):
data[arg.value.s] = section
if arg.arg == "version" and isinstance(arg.value, ast.Str):
section["version"] = arg.value.s
if arg.arg == "name" and isinstance(arg.value, ast.Constant):
data[arg.value.value] = section
if arg.arg == "version" and isinstance(arg.value,
ast.Constant):
section["version"] = arg.value.value
if arg.arg == "deps" and isinstance(arg.value, ast.List):
deps = []
for dep in arg.value.elts:
if isinstance(dep, ast.Call) and isinstance(
dep.args[0], ast.Str):
deps.append(dep.args[0].s)
elif isinstance(dep, ast.Str):
deps.append(dep.s)
dep.args[0], ast.Constant):
deps.append(dep.args[0].value)
elif isinstance(dep, ast.Constant):
deps.append(dep.value)
else:
raise Exception(ast.dump(dep))
section["deps"] = deps
Expand All @@ -44,8 +45,8 @@ def parse_bazel(build: str) -> PackageData:


def parse_cabal(cabal: str) -> Dict[str, PackageData]:
data: Dict[str, PackageData] = (
collections.defaultdict(lambda: collections.defaultdict(dict)))
data: Dict[str, PackageData] = collections.defaultdict(
lambda: collections.defaultdict(dict))
section = data[""][""]
key = ""
value = ""
Expand Down Expand Up @@ -78,10 +79,11 @@ def parse_cabal(cabal: str) -> Dict[str, PackageData]:


def resolve_bazel_deps(
bazel: str,
data: PackageData,
name: str,
bazel: str,
data: PackageData,
name: str,
) -> Set[str]:

def go(name: str) -> List[str]:
deps = []
rule = data.get(name, None)
Expand Down Expand Up @@ -122,11 +124,11 @@ def must_str(maybe_list: Union[str, List[str]]) -> str:


def check_deps(
bazel: str,
cabal: str,
bazel_data: PackageData,
bazel_name: str,
cabal_section: PackageSection,
bazel: str,
cabal: str,
bazel_data: PackageData,
bazel_name: str,
cabal_section: PackageSection,
) -> None:
bazel_deps = resolve_bazel_deps(bazel, bazel_data, bazel_name)
cabal_deps = {
Expand Down Expand Up @@ -163,9 +165,9 @@ def check_deps(


def check_version(
root: PackageSection,
bazel_data: PackageData,
package_name: str,
root: PackageSection,
bazel_data: PackageData,
package_name: str,
) -> None:
cabal_version = root["version"]
bazel_version = bazel_data["hs-" + package_name]["version"]
Expand Down
Loading