mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-28 07:51:33 +00:00
Merge pull request #7438 from kalsprite/asm_doc_category
Give asm templates a documentation category instead of a blank header and a null `%s`
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// Generates Documentation
|
||||
|
||||
gb_global int print_entity_kind_ordering[Entity_Count] = {
|
||||
gb_global int print_entity_kind_ordering[] = {
|
||||
/*Invalid*/ -1,
|
||||
/*Constant*/ 0,
|
||||
/*Variable*/ 1,
|
||||
@@ -12,8 +12,10 @@ gb_global int print_entity_kind_ordering[Entity_Count] = {
|
||||
/*LibraryName*/ -1,
|
||||
/*Nil*/ -1,
|
||||
/*Label*/ -1,
|
||||
/*AsmTemplate*/ 5,
|
||||
};
|
||||
gb_global char const *print_entity_names[Entity_Count] = {
|
||||
GB_STATIC_ASSERT(gb_count_of(print_entity_kind_ordering) == Entity_Count);
|
||||
gb_global char const *print_entity_names[] = {
|
||||
/*Invalid*/ "",
|
||||
/*Constant*/ "constants",
|
||||
/*Variable*/ "variables",
|
||||
@@ -25,7 +27,9 @@ gb_global char const *print_entity_names[Entity_Count] = {
|
||||
/*LibraryName*/ "library names",
|
||||
/*Nil*/ "",
|
||||
/*Label*/ "",
|
||||
/*AsmTemplate*/ "asm templates",
|
||||
};
|
||||
GB_STATIC_ASSERT(gb_count_of(print_entity_names) == Entity_Count);
|
||||
|
||||
|
||||
gb_internal GB_COMPARE_PROC(cmp_entities_for_printing) {
|
||||
@@ -257,6 +261,7 @@ gb_internal void print_doc_package(CheckerInfo *info, AstPackage *pkg) {
|
||||
case Entity_ProcGroup:
|
||||
case Entity_ImportName:
|
||||
case Entity_LibraryName:
|
||||
case Entity_AsmTemplate:
|
||||
// Fine
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3455,6 +3455,7 @@ gb_internal void print_show_unused(Checker *c) {
|
||||
case Entity_ProcGroup:
|
||||
case Entity_ImportName:
|
||||
case Entity_LibraryName:
|
||||
case Entity_AsmTemplate:
|
||||
// Fine
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ set COMMON=-define:ODIN_TEST_FANCY=false -file -vet -strict-style -ignore-unused
|
||||
..\..\..\odin check ..\test_issue_ellipsis_type_call.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "10" || exit /b
|
||||
..\..\..\odin check ..\test_issue_foreign_redeclaration.odin -no-entry-point %COMMON% || exit /b
|
||||
..\..\..\odin check ..\test_issue_foreign_redeclaration_mismatch.odin -no-entry-point %COMMON% 2>&1 | find /c "Error:" | findstr /x "1" || exit /b
|
||||
..\..\..\odin doc ..\test_issue_asm_doc_category.odin -file 2>&1 | find /c "asm templates" | findstr /x "1" || exit /b
|
||||
..\..\..\odin build ..\test_issue_7037.odin %COMMON% -o:none || exit /b
|
||||
..\..\..\odin build ..\test_issue_7188.odin %COMMON% || exit /b
|
||||
clang -c ..\test_issue_sysv_abi.c -o test_issue_sysv_abi_c.o || exit /b
|
||||
|
||||
@@ -114,6 +114,16 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# `asm` templates are amd64-only, so this file is empty on every other architecture
|
||||
if [[ "$(uname -m)" == "x86_64" || "$(uname -m)" == "amd64" ]]; then
|
||||
if [[ $($ODIN doc ../test_issue_asm_doc_category.odin -file 2>&1 | grep -c "asm templates") -eq 1 ]]; then
|
||||
echo "SUCCESSFUL 1/1"
|
||||
else
|
||||
echo "SUCCESSFUL 0/1"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $($ODIN build ../test_issue_7108.odin $COMMON 2>&1 >/dev/null | grep -c "Error:") -eq 2 ]]; then
|
||||
echo "SUCCESSFUL 1/1"
|
||||
else
|
||||
|
||||
16
tests/issues/test_issue_asm_doc_category.odin
Normal file
16
tests/issues/test_issue_asm_doc_category.odin
Normal file
@@ -0,0 +1,16 @@
|
||||
#+build amd64
|
||||
// `Entity_AsmTemplate` was added to `ENTITY_KINDS` but not to the two `[Entity_Count]` tables in
|
||||
// `src/docs.cpp`, so its slot was zero-filled: ordering `0` and a null name. `odin doc` and
|
||||
// `odin check -show-unused` printed an `asm` template under an empty category header, and passed
|
||||
// the null name to a `%s`.
|
||||
package test_issues
|
||||
|
||||
DOC_CONST :: 1
|
||||
|
||||
doc_proc :: proc() {}
|
||||
|
||||
doc_asm :: asm() { nop; }
|
||||
|
||||
doc_asm_32 :: asm(a: i32) -> (v: i32) { mov v, a; }
|
||||
doc_asm_64 :: asm(a: i64) -> (v: i64) { mov v, a; }
|
||||
doc_asm_group :: asm { doc_asm_32, doc_asm_64 }
|
||||
Reference in New Issue
Block a user