NULLABLE annotation
This commit is contained in:
parent
9da8732d93
commit
b8296a45a7
@ -45,7 +45,7 @@ typedef struct VM {
|
||||
};
|
||||
|
||||
VMState state;
|
||||
char* error_message;
|
||||
NULLABLE(char* error_message);
|
||||
|
||||
u8* data;
|
||||
size_t data_size;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "impl_macros.h"
|
||||
|
||||
FILE* fileFromN(VM* vm, size_t pos, u32 file_n){
|
||||
NULLABLE(FILE* fileFromN(VM* vm, size_t pos, u32 file_n)){
|
||||
FILE* f = NULL;
|
||||
switch(file_n){
|
||||
case 0: f = stdin; break;
|
||||
|
||||
@ -16,7 +16,7 @@ const Instruction instructions[] = {
|
||||
};
|
||||
const size_t instructions_count = sizeof(instructions)/sizeof(instructions[0]);
|
||||
|
||||
const Instruction* Instruction_getFromOpcode(u8 opcode){
|
||||
NULLABLE(const Instruction* Instruction_getFromOpcode(u8 opcode)){
|
||||
if(opcode >= instructions_count)
|
||||
return NULL;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ typedef struct Instruction {
|
||||
/// @brief get instruction info from table
|
||||
/// @param opcode any byte
|
||||
/// @return ptr to struct or NULL
|
||||
const Instruction* Instruction_getFromOpcode(u8 opcode);
|
||||
NULLABLE(const Instruction* Instruction_getFromOpcode(u8 opcode));
|
||||
|
||||
i32 NOP_impl(VM* vm, size_t pos);
|
||||
i32 PUSH_impl(VM* vm, size_t pos);
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#define arg_is(STR) (strcmp(argv[argi], STR) == 0)
|
||||
|
||||
i32 main(const i32 argc, const char** argv){
|
||||
const char* filename = NULL;
|
||||
const char* NULLABLE(filename) = NULL;
|
||||
|
||||
for(i32 argi = 1; argi < argc; argi++){
|
||||
if(arg_is("-h") || arg_is("--help")){
|
||||
|
||||
Loading…
Reference in New Issue
Block a user