-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
#pragma safety enable | ||
|
||
|
||
struct X | ||
{ | ||
char* _Owner _Opt text; | ||
}; | ||
|
||
void free(void* _Owner _Opt p); | ||
void* _Owner _Opt calloc(int n, int sz); | ||
|
||
|
||
struct X* _Owner make(); | ||
char* _Owner _Opt strdup(const char* s); | ||
[[noreturn]] void exit( int exit_code ); | ||
|
||
void f(int condition) | ||
void f() | ||
{ | ||
struct X* _Owner _Opt p = calloc(1, sizeof * p); | ||
try | ||
{ | ||
if (p == nullptr) | ||
throw; | ||
|
||
|
||
if (condition) | ||
throw; | ||
p->text = strdup("a"); | ||
} | ||
catch | ||
char * _Opt _Owner s = strdup("a"); | ||
|
||
if (s == nullptr) | ||
{ | ||
exit(1); | ||
} | ||
|
||
static_state(s, "not-null"); | ||
free(s); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma safety enable | ||
|
||
void free(void* _Owner _Opt p); | ||
char* _Owner _Opt strdup(const char* s); | ||
[[noreturn]] void exit( int exit_code ); | ||
|
||
void f() | ||
{ | ||
char * _Opt _Owner s = strdup("a"); | ||
|
||
if (s == nullptr) | ||
{ | ||
exit(1); | ||
} | ||
|
||
static_state(s, "not-null"); | ||
free(s); | ||
} |