Module changes, found Type_Incomplete error

This commit is contained in:
Krzosa Karol
2022-10-14 17:20:46 +02:00
parent a60df75cc3
commit e07ad3c86d
7 changed files with 59 additions and 15 deletions

View File

@@ -2,9 +2,10 @@
pushd %~dp0
rem cl main.cpp -I.. user32.lib
rem clang core_main.cpp -O0 -Wall -Wno-unused-function -fno-exceptions -fdiagnostics-absolute-paths -g -o main.exe -Wl,user32.lib
clang core_main.cpp -O0 -Wall -Wno-unused-function -fno-exceptions -fdiagnostics-absolute-paths -g -o main.exe -Wl,user32.lib
rem ubuntu run clang core_main.cpp -O0 -Wall -Wno-unused-function -fno-exceptions -fdiagnostics-absolute-paths -g -o core.out
echo Building arms race
call examples/arms_race/build_arms_race.bat
rem main examples/arms_race/arms_race.core

View File

@@ -79,6 +79,8 @@ get_ctype_name_for_type(Ast_Type *type){
case TYPE_U64: return "uint64_t";
case TYPE_TUPLE: return "Tuple";
case TYPE_TYPE: return "int64_t";
case TYPE_INCOMPLETE: return "(Internal compiler error: [Type_Incomplete])";
invalid_default_case;
}
return "<unknown_type>";

View File

@@ -14,6 +14,16 @@ Fix backlog
- [ ] This error is valid error case when someone creates a compound out of basic type C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:137 Internal compiler error: Invalid type was passed to the compound expression, should have been an array, struct or slice
result := String{data, filesize}
- [ ] Fix tuple being able to colapse into a single variable
- [ ] Fix Found multiple definitions of not showing multiple definitions in the error message
- [ ] Fix being able to cast -1 to *void
- [ ] How to cast from U64 to pointer?
- [ ] Fix returning literlas using multiple arguments ```
C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:141:35: error: cannot take the address of an rvalue of type 'int'
MemoryCopy(&S10_S11_S44_139.m0, &(0x0), sizeof(S10_S11_S44_139.m0));
^ ~~~
C:/AProgramming/cparse/compiler/examples/arms_race/arms_race.core:142:35: error: cannot take the address of an rvalue of type 'unsigned long long'
MemoryCopy(&S10_S11_S44_139.m1, &(32ULL), sizeof(S10_S11_S44_139.m1));
```
Future features

View File

@@ -1618,8 +1618,6 @@ resolve_decl(Ast_Decl *ast){
ast->state = DECL_RESOLVING;
{
// @idea: LAMBDAS maybe get rid of lambdas and replace them with a
// marker that signifies whether code
switch(ast->kind){
CASE(LAMBDA, Decl){
Ast_Lambda *lambda = node->lambda;

View File

@@ -16,7 +16,14 @@ Init :: (a: *Arena)
a.memory = OS.Reserve(DEFAULT_RESERVE_SIZE)
a.alignment = DEFAULT_ALIGNMENT
a.di = ArenaDI++
// a.allocator.proc = arena_allocator_proc
FromBuffer :: (buffer: []U8): Arena
a: Arena
a.memory.reserve = Len(buffer)->U64
a.memory.commit = Len(buffer)->U64
a.alignment = DEFAULT_ALIGNMENT
a.di = ArenaDI++
return a
PushSize :: (a: *Arena, size: Base.SizeU): *void
generous_size := size + a.alignment
@@ -31,15 +38,5 @@ PushSize :: (a: *Arena, size: Base.SizeU): *void
a.len += size
return result
// @todo: Make this compile time thing!!!
// This probably will wait till polymorphism stuff
// something like this:
// PushType :: (a: *Arena, type: $T): *T
//
PushType :: (a: *Arena, type: Type): *void
type_info := get_type_info(type)
Assert(type_info != 0)
return PushSize(a, type_info.size->Base.SizeU)
Release :: (a: *Arena)
OS.Release(&a.memory)

View File

@@ -31,6 +31,9 @@ LARGE_INTEGER :: S64
PLARGE_INTEGER :: *LARGE_INTEGER
LPOVERLAPPED :: *OVERLAPPED
LONG_PTR :: *S64
ULONG_PTR :: *U64
MEM_COMMIT :: 0x00001000
MEM_RESERVE :: 0x00002000
MEM_RESET :: 0x00080000
@@ -78,6 +81,12 @@ OVERLAPPED :: struct
Pointer: PVOID
hEvent: HANDLE
LPSECURITY_ATTRIBUTES :: *SECURITY_ATTRIBUTES
SECURITY_ATTRIBUTES :: struct
nLength: DWORD
lpSecurityDescriptor: LPVOID
bInheritHandle: BOOL
GENERIC_READ :: 0x80000000
GENERIC_WRITE :: 0x40000000
GENERIC_EXECUTE :: 0x20000000
@@ -92,3 +101,30 @@ TRUNCATE_EXISTING :: 5
FILE_SHARE_READ :: 0x00000001
FILE_SHARE_WRITE :: 0x00000002
FILE_SHARE_DELETE :: 0x00000004
// INVALID_HANDLE_VALUE :: ((-1)->LONG_PTR)->HANDLE
INVALID_HANDLE_VALUE :: (~(0->U64))
FILE_ATTRIBUTE_READONLY :: 0x00000001
FILE_ATTRIBUTE_HIDDEN :: 0x00000002
FILE_ATTRIBUTE_SYSTEM :: 0x00000004
FILE_ATTRIBUTE_DIRECTORY :: 0x00000010
FILE_ATTRIBUTE_ARCHIVE :: 0x00000020
FILE_ATTRIBUTE_DEVICE :: 0x00000040
FILE_ATTRIBUTE_NORMAL :: 0x00000080
FILE_ATTRIBUTE_TEMPORARY :: 0x00000100
FILE_ATTRIBUTE_SPARSE_FILE :: 0x00000200
FILE_ATTRIBUTE_REPARSE_POINT :: 0x00000400
FILE_ATTRIBUTE_COMPRESSED :: 0x00000800
FILE_ATTRIBUTE_OFFLINE :: 0x00001000
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED :: 0x00002000
FILE_ATTRIBUTE_ENCRYPTED :: 0x00004000
FILE_ATTRIBUTE_INTEGRITY_STREAM :: 0x00008000
FILE_ATTRIBUTE_VIRTUAL :: 0x00010000
FILE_ATTRIBUTE_NO_SCRUB_DATA :: 0x00020000
FILE_ATTRIBUTE_EA :: 0x00040000
FILE_ATTRIBUTE_PINNED :: 0x00080000
FILE_ATTRIBUTE_UNPINNED :: 0x00100000
FILE_ATTRIBUTE_RECALL_ON_OPEN :: 0x00040000
FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS :: 0x00400000

View File

@@ -53,7 +53,7 @@ DestroyBitmap :: (b: *WIN32_Bitmap)
ZeroMemory(b, SizeOf(WIN32_Bitmap))
DrawBitmapInCompatibleDC :: (b: *WIN32_Bitmap)
if(IsValidBitmap(b))
if IsValidBitmap(b)
SelectObject(b.hdc, b.dib)
BitBlt(b.compatible_dc, 0, 0, b.size.x->int, b.size.y->int, b.hdc, 0, 0, SRCCOPY)