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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

char* ast_type_direct_json(ast_type_t type)
{
(void)type; // Suppress unused parameter warning
buffer_t* temp = buffer_create(256);
buffer_append_char(temp, '{');
buffer_append_str(temp, "\"type\":null");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_argument_item_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this fixes the empty translation unit warning, using identifiers that begin with a double underscore like __dummy_type is not recommended. Such names are reserved for the C implementation (compiler and standard library). Using them can lead to undefined behavior if they conflict with an implementation-defined name. A safer alternative would be to use a name that doesn't fall into the reserved namespace. This comment applies to all other files where __dummy_type has been introduced.

Suggested change
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
typedef int dummy_type; // Placeholder to avoid empty translation unit error

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

As mentioned in other files, identifiers starting with a double underscore are reserved. Please use a non-reserved name to avoid potential conflicts and undefined behavior.

Suggested change
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
typedef int dummy_type; // Placeholder to avoid empty translation unit error

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_binary_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_binary_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_call_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_call_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_identifier_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_index_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_index_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_item_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_literal_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_unary_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expression_unary_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_expressions_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_import_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_import_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_import_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_decl_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_decl_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_decl_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_enum_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_enum_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_enum_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_struct_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_struct_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_struct_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_union_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_union_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

void ast_kind_union_direct_destroy(ast_kind_union_t kind_union)
{
(void)kind_union; // Suppress unused parameter warning
DEBUG_ME;
// TODO
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

char* ast_kind_union_direct_json(ast_kind_union_t kind_union)
{
(void)kind_union; // Suppress unused parameter warning
DEBUG_ME;
buffer_t* temp = buffer_create(256);
buffer_append_char(temp, '{');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_kind_union_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_package_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_package_destroy.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_package_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_expression_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_expression_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_for_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_for_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_foreach_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_foreach_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_if_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_if_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_print_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_raw_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_return_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_variable_decl_create.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "ast_statement_variable_decl_log.h"

// Implementation here
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
5 changes: 3 additions & 2 deletions src/stage/ast/type.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ typedef struct
typedef struct
{
// TODO
char dummy;
} ast_kind_union_t;

typedef struct
Expand Down Expand Up @@ -389,7 +390,7 @@ typedef struct
size_t value_count;
} ast_arguments_t;

typedef struct ast_t {
struct ast_t {
ast_base_t base;
union {
// program
Expand Down Expand Up @@ -456,6 +457,6 @@ typedef struct ast_t {
ast_statement_variable_decl_t statement_variable_decl_value;
ast_statement_expression_t statement_expression_value;
} raw;
} ast_t;
};

#endif // _STAGE_AST_TYPE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

buffer_t* generator_c_expression_identifier(generator_t* generator, ast_t* ast)
{
(void)generator; // Suppress unused parameter warning
DEBUG_ME;
ast_expression_item_t expression_item = ast->raw.expression_item_value;
ast_expression_identifier_t expression_identifier = expression_item.raw.identifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

buffer_t* generator_c_expression_literal(generator_t* generator, ast_t* ast)
{
(void)generator; // Suppress unused parameter warning
DEBUG_ME;
ast_expression_item_t expression_item = ast->raw.expression_item_value;
ast_expression_literal_t expression_literal = expression_item.raw.literal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

buffer_t* generator_c_statement_ret(generator_t* generator, ast_t* ast)
{
(void)generator; // Suppress unused parameter warning
(void)ast; // Suppress unused parameter warning
buffer_t* temp = buffer_create(1024);

buffer_append_str(temp, "return ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

buffer_t* generator_c_type(generator_t* generator, ast_t* ast)
{
(void)generator; // Suppress unused parameter warning
DEBUG_ME;
buffer_t* temp = buffer_create(12);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

void generator_destroy(generator_t* generator)
{
(void)generator; // Suppress unused parameter warning
DEBUG_ME;

// TODO
Expand Down
1 change: 1 addition & 0 deletions src/stage/generator/generator_llvm/generator_llvm.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "generator_llvm.h"

// generator_llvm(...)
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This identifier __dummy_type uses a reserved name pattern (starts with double underscore). To ensure portability and avoid undefined behavior, please use a name that is not reserved.

Suggested change
typedef int __dummy_type; // Placeholder to avoid empty translation unit error
typedef int dummy_type; // Placeholder to avoid empty translation unit error

1 change: 1 addition & 0 deletions src/stage/parser/parser_json/parser_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

char* parser_json(parser_t* parser)
{
(void)parser; // Suppress unused parameter warning
buffer_t* temp = buffer_create(24);

// TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

ast_t* parser_parse_arguments(parser_t* parser)
{
(void)parser; // Suppress unused parameter warning
return NULL;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ast_expression_item_t validator_validate_direct_expression_item(ast_expression_i
validator_validate_type(expression_item.runtime_type);
}

ast_type_type_t type;
switch (expression_item.type) {
case AST_EXPRESSION_TYPE_LITERAL:
ast_type_type_t type;
switch (expression_item.raw.literal.value->type) {
case VALUE_TYPE_STRING:
type = AST_KIND_TYPE_STRING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

void validator_validate_value(value_t* value)
{
(void)value; // Suppress unused parameter warning
DEBUG_ME;
}
3 changes: 3 additions & 0 deletions src/stage/value/value_destroy/value_destroy.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ void value_destroy(value_t* value)
case VALUE_TYPE_NULL:
// No need to free null_value
break;
case VALUE_TYPE_SIZE:
// No need to free size_value
break;
}

memory_destroy(value);
Expand Down
3 changes: 3 additions & 0 deletions src/stage/value/value_log/value_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@ void value_log(value_t* value)
case VALUE_TYPE_NULL:
log_info("Value: Null\n");
break;
case VALUE_TYPE_SIZE:
log_info("Value: Size(%zu)\n", value->raw.size_value);
break;
}
}
3 changes: 3 additions & 0 deletions src/stage/value/value_name/value_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ char* value_name(value_type_t type)

case VALUE_TYPE_NULL: return "NULL";
break;

case VALUE_TYPE_SIZE: return "SIZE";
break;
}
return "VALUE_UNKNOWN";
}
Loading