Skip to content

Commit e5b4f5e

Browse files
committed
fixed assert
1 parent fb6a4b4 commit e5b4f5e

File tree

13 files changed

+290
-268
lines changed

13 files changed

+290
-268
lines changed

ownership.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11

22
Last Updated 5 December 2025
33

4-
This is a work in progress. Cake source is currently being used to validate the concepts. It's in the process of transitioning to include annotated nullable checks, which was the last feature added.
4+
This is a work in progress. Cake source is currently being used to validate the concepts.
55

66

77
## Abstract
88

99
The objective is to statically check code and prevent bugs, including memory bugs like double free,
10-
null dereference and memory leaks. New type-annotations have been created to extend the type system
11-
and insert information that defines contracts.
10+
null dereference and memory leaks.
1211

13-
Ultimately, we still have the same language, but with an improved type system that checks these
14-
contracts.
12+
Type-annotations have been created to extend the type system and insert information that defines contracts.
1513

1614
These new type-annotations can be ignored, the language **and existing code patterns** remains unmodified.
1715

18-
1916
## Concepts
2017

2118
### Nullable Pointers
@@ -39,7 +36,8 @@ existing code will naturally conflict with the new rules, as some unqualified po
3936
existing code can be nullable; they simply are not reviewed yet.
4037
4138
The directive `#pragma nullable enable/disable` can be used during the process of upgrading code.
42-
`nullable enable` means that the new rules apply, while `nullable disable` indicates that all pointers
39+
40+
`#pragma nullable enable` means that the new rules apply, while `#pragma nullable disable` indicates that all pointers
4341
are nullable. Similar approach has been used in C# [1].
4442
4543
It is important to note that, although the semantics change, this only affects static analysis;

src/build.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void generate_doc(const char* mdfilename, const char* outfile)
8282
"</head>\n"
8383
"<body>\n"
8484
" <article style=\"max-width: 40em; margin:auto\">\n"
85-
"<p><a href=\"index.html\">Home</a> | <a href=\"manual.html\">Manual</a> | <a href=\"playground.html\">Playground</a></p>\n"
85+
"<p><a href=\"index.html\">Home</a> | <a href=\"manual.html\">Manual</a> | <a href=\"ownership.html\">Ownership</a> | <a href=\"playground.html\">Playground</a></p>\n"
8686
"<article>\n"
8787
"<h1>Cake - C23 and Beyond</h1>\n";
8888

src/file.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
void main() {
2-
int i;
3-
switch (i) {
4-
case 0:
5-
if (1) {
6-
break;
7-
}
1+
int main(int argc, char *argv[]) {
2+
while (1) {
3+
if (argc) {
4+
goto one;
5+
}
6+
else {
7+
goto zero;
8+
}
9+
zero:
10+
return 0;
11+
one:
12+
return 1;
813
}
914
}

src/lib.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28720,7 +28720,7 @@ void defer_start_visit_declaration(struct defer_visit_ctx* ctx, struct declarati
2872028720

2872128721
//#pragma once
2872228722

28723-
#define CAKE_VERSION "0.12.68"
28723+
#define CAKE_VERSION "0.12.69"
2872428724

2872528725

2872628726

@@ -42098,6 +42098,11 @@ static void defer_visit_ctx_pop_until(struct defer_visit_ctx* ctx, struct defer_
4209842098

4209942099
static void defer_visit_secondary_block(struct defer_visit_ctx* ctx, struct secondary_block* p_secondary_block)
4210042100
{
42101+
if (ctx->searching_label_mode && ctx->p_label)
42102+
{
42103+
return;
42104+
}
42105+
4210142106
defer_visit_statement(ctx, p_secondary_block->statement);
4210242107
}
4210342108

src/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#define CAKE_VERSION "0.12.68"
7+
#define CAKE_VERSION "0.12.69"
88

99

1010

src/visit_defer.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ static void defer_visit_ctx_pop_until(struct defer_visit_ctx* ctx, struct defer_
138138

139139
static void defer_visit_secondary_block(struct defer_visit_ctx* ctx, struct secondary_block* p_secondary_block)
140140
{
141+
if (ctx->searching_label_mode && ctx->p_label)
142+
{
143+
return;
144+
}
145+
141146
defer_visit_statement(ctx, p_secondary_block->statement);
142147
}
143148

src/web/cakejs.js

Lines changed: 248 additions & 237 deletions
Large diffs are not rendered by default.

src/web/code.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</script></head>
2727
<body>
2828
<article style="max-width: 40em; margin:auto">
29-
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="playground.html">Playground</a></p>
29+
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="ownership.html">Ownership</a> | <a href="playground.html">Playground</a></p>
3030
<article>
3131
<h1>Cake - C23 and Beyond</h1>
3232
<ul>

src/web/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</script></head>
2727
<body>
2828
<article style="max-width: 40em; margin:auto">
29-
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="playground.html">Playground</a></p>
29+
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="ownership.html">Ownership</a> | <a href="playground.html">Playground</a></p>
3030
<article>
3131
<h1>Cake - C23 and Beyond</h1>
3232
<ul>

src/web/manual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</script></head>
2727
<body>
2828
<article style="max-width: 40em; margin:auto">
29-
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="playground.html">Playground</a></p>
29+
<p><a href="index.html">Home</a> | <a href="manual.html">Manual</a> | <a href="ownership.html">Ownership</a> | <a href="playground.html">Playground</a></p>
3030
<article>
3131
<h1>Cake - C23 and Beyond</h1>
3232
<ul>

0 commit comments

Comments
 (0)