From 54bb1363a26b6a52cf1a8ecf1f16f76e9920956f Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Wed, 11 Jan 2023 23:26:04 +0000 Subject: get it to compile with clang --- command_line/CmdLine/Src/Project/CLAccessPaths.c | 49 ++++++----------- command_line/CmdLine/Src/Project/CLFiles.c | 19 +++---- command_line/CmdLine/Src/Project/CLOverlays.c | 67 ++++++++---------------- command_line/CmdLine/Src/Project/CLProj.c | 3 +- command_line/CmdLine/Src/Project/CLSegs.c | 21 +++----- 5 files changed, 55 insertions(+), 104 deletions(-) (limited to 'command_line/CmdLine/Src/Project') diff --git a/command_line/CmdLine/Src/Project/CLAccessPaths.c b/command_line/CmdLine/Src/Project/CLAccessPaths.c index d20b16b..1b455da 100644 --- a/command_line/CmdLine/Src/Project/CLAccessPaths.c +++ b/command_line/CmdLine/Src/Project/CLAccessPaths.c @@ -32,8 +32,7 @@ void Path_Free(Path *path) { } Boolean Paths_Initialize(Paths *paths) { -#line 52 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(52, paths != NULL); memset(paths, 0, sizeof(Paths)); paths->pathsArray = NULL; @@ -43,8 +42,7 @@ Boolean Paths_Initialize(Paths *paths) { Boolean Paths_Terminate(Paths *paths) { UInt16 index; -#line 63 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(63, paths != NULL); if (paths->pathsArray) { for (index = 0; index < paths->pathsCount; index++) @@ -59,8 +57,7 @@ Boolean Paths_Terminate(Paths *paths) { static Boolean Paths_GrowPaths(Paths *paths, UInt16 *index) { Path **newArray; -#line 84 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(84, paths != NULL); if (paths->pathsCount >= paths->arraySize) { paths->arraySize += 20; @@ -116,8 +113,7 @@ Boolean Paths_DeletePath(Paths *paths, UInt16 index) { } Path *Paths_GetPath(Paths *paths, UInt16 pathnum) { -#line 151 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(151, paths != NULL); if (pathnum < paths->pathsCount) return paths->pathsArray[pathnum]; @@ -126,8 +122,7 @@ Path *Paths_GetPath(Paths *paths, UInt16 pathnum) { } UInt16 Paths_Count(const Paths *paths) { -#line 161 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(161, paths != NULL); return paths->pathsCount; } @@ -135,8 +130,7 @@ UInt16 Paths_Count(const Paths *paths) { Boolean Paths_FindPath(const Paths *paths, const Path *path) { UInt16 idx; -#line 169 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(169, paths != NULL); for (idx = 0; idx < paths->pathsCount; idx++) { if (paths->pathsArray[idx] == path) @@ -150,8 +144,7 @@ Path *Paths_FindPathSpec(const Paths *paths, const OSPathSpec *dir) { UInt16 idx; Path *path; -#line 182 - OPTION_ASSERT(paths != NULL); + OS_ASSERT(182, paths != NULL); for (idx = 0; idx < paths->pathsCount; idx++) { path = paths->pathsArray[idx]; @@ -220,8 +213,7 @@ int Paths_CountRecurse(Paths *paths) { mine = Paths_Count(paths); for (idx = 0; idx < mine; idx++) { path = Paths_GetPath(paths, idx); -#line 336 - OPTION_ASSERT(path); + OS_ASSERT(336, path); if (path->recursive) mine += Paths_CountRecurse(path->recursive); @@ -237,11 +229,9 @@ static void CopyRecurseFSS(FSSpec **list, Paths *paths, UInt16 *count) { for (idx = 0; idx < Paths_Count(paths); idx++) { path = Paths_GetPath(paths, idx); -#line 353 - OPTION_ASSERT(path && *count > 0); + OS_ASSERT(353, path && *count > 0); OS_MakeSpecWithPath(path->spec, NULL, 0, &spec); -#line 355 - OPTION_ASSERT(OS_OSSpec_To_FSSpec(&spec, *list)); + OS_ASSERT(355, OS_OSSpec_To_FSSpec(&spec, *list)); (*list)++; (*count)--; if (path->recursive) @@ -251,13 +241,11 @@ static void CopyRecurseFSS(FSSpec **list, Paths *paths, UInt16 *count) { void Paths_CopyRecurseFSS(FSSpec *list, Paths *paths, UInt16 count) { CopyRecurseFSS(&list, paths, &count); -#line 367 - OPTION_ASSERT(count == 0); + OS_ASSERT(367, count == 0); } static Boolean Frameworks_Initialize(Frameworks *fws) { -#line 405 - OPTION_ASSERT(fws != NULL); + OS_ASSERT(405, fws != NULL); memset(fws, 0, sizeof(Frameworks)); fws->fwsArray = NULL; @@ -267,8 +255,7 @@ static Boolean Frameworks_Initialize(Frameworks *fws) { static Boolean Frameworks_Grow(Frameworks *fws, UInt16 *index) { Paths_FWInfo **newArray; -#line 418 - OPTION_ASSERT(fws != NULL); + OS_ASSERT(418, fws != NULL); if (fws->fwsCount >= fws->arraySize) { fws->arraySize += 20; @@ -461,9 +448,8 @@ void Framework_GetEnvInfo(void) { int err; Boolean is_file; -#line 672 - OPTION_ASSERT(Paths_Initialize(&FrameworkPaths) == 1); - OPTION_ASSERT(Frameworks_Initialize(&FrameworkInfo) == 1); + OS_ASSERT(672, Paths_Initialize(&FrameworkPaths) == 1); + OS_ASSERT(673, Frameworks_Initialize(&FrameworkInfo) == 1); env = getenv("MWFrameworkPaths"); if (env) { @@ -518,8 +504,7 @@ int Frameworks_GetCount(void) { } Paths_FWInfo *Frameworks_GetInfo(int which) { -#line 762 - OPTION_ASSERT(FrameworkInfo.fwsArray); - OPTION_ASSERT(FrameworkInfo.fwsCount > which); + OS_ASSERT(762, FrameworkInfo.fwsArray); + OS_ASSERT(763, FrameworkInfo.fwsCount > which); return FrameworkInfo.fwsArray[which]; } diff --git a/command_line/CmdLine/Src/Project/CLFiles.c b/command_line/CmdLine/Src/Project/CLFiles.c index 6953df1..e651c73 100644 --- a/command_line/CmdLine/Src/Project/CLFiles.c +++ b/command_line/CmdLine/Src/Project/CLFiles.c @@ -30,8 +30,7 @@ void File_Free(File *file) { } Boolean Files_Initialize(Files *this) { -#line 47 - OPTION_ASSERT(this != NULL); + OS_ASSERT(47, this != NULL); return 1; } @@ -39,8 +38,7 @@ Boolean Files_Terminate(Files *this) { File *file; File *next; -#line 56 - OPTION_ASSERT(this != NULL); + OS_ASSERT(56, this != NULL); for (file = this->fileList; file; file = next) { next = file->next; @@ -57,9 +55,8 @@ Boolean Files_AddFile(Files *this, File *file) { Boolean Files_InsertFile(Files *this, File *file, SInt32 position) { File **scan; -#line 80 - OPTION_ASSERT(this != NULL); - OPTION_ASSERT(file != NULL); + OS_ASSERT(80, this != NULL); + OS_ASSERT(81, file != NULL); if (position < 0) position = 0; @@ -81,9 +78,8 @@ Boolean Files_InsertFile(Files *this, File *file, SInt32 position) { File *Files_GetFile(Files *this, SInt32 filenum) { File *file; -#line 104 - OPTION_ASSERT(this != NULL); - OPTION_ASSERT(filenum >= 0); + OS_ASSERT(104, this != NULL); + OS_ASSERT(105, filenum >= 0); file = this->fileList; while (file && file->filenum != filenum) @@ -101,8 +97,7 @@ File *Files_FindFile(Files *this, OSSpec *spec) { } int Files_Count(Files *this) { -#line 127 - OPTION_ASSERT(this != NULL); + OS_ASSERT(127, this != NULL); return this->fileCount; } diff --git a/command_line/CmdLine/Src/Project/CLOverlays.c b/command_line/CmdLine/Src/Project/CLOverlays.c index 3437366..2656869 100644 --- a/command_line/CmdLine/Src/Project/CLOverlays.c +++ b/command_line/CmdLine/Src/Project/CLOverlays.c @@ -6,8 +6,7 @@ Boolean Overlays_Initialize(Overlays *this) { OvlAddr addr; SInt32 idx; -#line 24 - OPTION_ASSERT(this); + OS_ASSERT(24, this); this->groups = NULL; this->lastgrp = NULL; @@ -24,12 +23,10 @@ Boolean Overlays_Initialize(Overlays *this) { return 0; OvlGroup_AddOverlay(grp, ovl, &idx); -#line 42 - OPTION_ASSERT(idx==0); + OS_ASSERT(42, idx==0); Overlays_AddOvlGroup(this, grp, &idx); -#line 45 - OPTION_ASSERT(idx==0); + OS_ASSERT(45, idx==0); return 1; } @@ -38,8 +35,7 @@ Boolean Overlays_Terminate(Overlays *this) { OvlGroup *grp; OvlGroup *nxtgrp; -#line 54 - OPTION_ASSERT(this); + OS_ASSERT(54, this); for (grp = this->groups; grp; grp = nxtgrp) { nxtgrp = grp->next; @@ -52,9 +48,8 @@ Boolean Overlays_Terminate(Overlays *this) { } Boolean Overlays_AddOvlGroup(Overlays *this, OvlGroup *grp, SInt32 *grpnum) { -#line 70 - OPTION_ASSERT(this); - OPTION_ASSERT(grp); + OS_ASSERT(70, this); + OS_ASSERT(71, grp); if (this->groups == NULL) this->groups = grp; @@ -73,8 +68,7 @@ OvlGroup *Overlays_GetOvlGroup(Overlays *this, SInt32 grpnum) { OvlGroup *grp; SInt32 cnt = 0; -#line 93 - OPTION_ASSERT(this); + OS_ASSERT(93, this); grp = this->groups; while (grp && cnt < grpnum) { @@ -92,8 +86,7 @@ SInt32 Overlays_CountGroups(Overlays *this) { OvlGroup *scan; int num = 0; -#line 112 - OPTION_ASSERT(this); + OS_ASSERT(112, this); scan = this->groups; while (scan) { @@ -107,8 +100,7 @@ SInt32 Overlays_CountGroups(Overlays *this) { Boolean Overlays_AddFileToOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filenum) { Overlay *oly; -#line 130 - OPTION_ASSERT(this); + OS_ASSERT(130, this); oly = Overlays_GetOverlayInGroup(this, grpnum, ovlnum); if (oly) @@ -120,8 +112,7 @@ Boolean Overlays_AddFileToOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, Overlay *Overlays_GetOverlayInGroup(Overlays *this, SInt32 grpnum, SInt32 ovlnum) { OvlGroup *grp; -#line 144 - OPTION_ASSERT(this); + OS_ASSERT(144, this); grp = Overlays_GetOvlGroup(this, grpnum); if (grp) @@ -133,8 +124,7 @@ Overlay *Overlays_GetOverlayInGroup(Overlays *this, SInt32 grpnum, SInt32 ovlnum SInt32 Overlays_GetFileInOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filnum) { Overlay *oly; -#line 160 - OPTION_ASSERT(this); + OS_ASSERT(160, this); oly = Overlays_GetOverlayInGroup(this, grpnum, ovlnum); if (oly) @@ -146,8 +136,7 @@ SInt32 Overlays_GetFileInOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, S OvlGroup *OvlGroup_New(const char *name, OvlAddr addr) { OvlGroup *grp; -#line 175 - OPTION_ASSERT(name); + OS_ASSERT(175, name); grp = xmalloc(NULL, sizeof(OvlGroup)); if (grp) { @@ -159,8 +148,7 @@ OvlGroup *OvlGroup_New(const char *name, OvlAddr addr) { grp->olycnt = 0; grp->next = NULL; } else { -#line 188 - DO_INTERNAL_ERROR("Could not allocate %s", "overlay group"); + DO_INTERNAL_ERROR(188, "Could not allocate %s", "overlay group"); } return grp; } @@ -169,8 +157,7 @@ void OvlGroup_Delete(OvlGroup *grp) { Overlay *scan; Overlay *next; -#line 197 - OPTION_ASSERT(grp); + OS_ASSERT(197, grp); for (scan = grp->olys; scan; scan = next) { next = scan->next; @@ -182,9 +169,8 @@ void OvlGroup_Delete(OvlGroup *grp) { } Boolean OvlGroup_AddOverlay(OvlGroup *this, Overlay *oly, SInt32 *olynum) { -#line 211 - OPTION_ASSERT(this); - OPTION_ASSERT(oly); + OS_ASSERT(211, this); + OS_ASSERT(212, oly); if (!this->lastoly) this->olys = oly; @@ -203,8 +189,7 @@ Overlay *OvlGroup_GetOverlay(OvlGroup *this, SInt32 olynum) { Overlay *oly; SInt32 cnt = 0; -#line 234 - OPTION_ASSERT(this); + OS_ASSERT(234, this); oly = this->olys; while (oly && cnt < olynum) { @@ -222,8 +207,7 @@ SInt32 OvlGroup_CountOverlays(OvlGroup *this) { Overlay *scan; int num = 0; -#line 254 - OPTION_ASSERT(this); + OS_ASSERT(254, this); scan = this->olys; while (scan) { @@ -246,15 +230,13 @@ Overlay *Overlay_New(const char *name) { oly->cnt = 0; oly->next = NULL; } else { -#line 281 - DO_INTERNAL_ERROR("Could not allocate %s", "overlay"); + DO_INTERNAL_ERROR(281, "Could not allocate %s", "overlay"); } return oly; } void Overlay_Delete(Overlay *oly) { -#line 288 - OPTION_ASSERT(oly); + OS_ASSERT(288, oly); if (oly->list) xfree(oly->list); @@ -262,8 +244,7 @@ void Overlay_Delete(Overlay *oly) { } Boolean Overlay_AddFile(Overlay *oly, SInt32 filenum, SInt32 *filnum) { -#line 296 - OPTION_ASSERT(oly); + OS_ASSERT(296, oly); if (oly->cnt >= oly->max) { oly->max += 16; @@ -279,8 +260,7 @@ Boolean Overlay_AddFile(Overlay *oly, SInt32 filenum, SInt32 *filnum) { } SInt32 Overlay_GetFile(Overlay *oly, SInt32 filnum) { -#line 314 - OPTION_ASSERT(oly); + OS_ASSERT(314, oly); if (filnum < oly->cnt) return oly->list[filnum]; @@ -289,8 +269,7 @@ SInt32 Overlay_GetFile(Overlay *oly, SInt32 filnum) { } SInt32 Overlay_CountFiles(Overlay *oly) { -#line 323 - OPTION_ASSERT(oly); + OS_ASSERT(323, oly); return oly->cnt; } diff --git a/command_line/CmdLine/Src/Project/CLProj.c b/command_line/CmdLine/Src/Project/CLProj.c index 83b2ce1..79b99ae 100644 --- a/command_line/CmdLine/Src/Project/CLProj.c +++ b/command_line/CmdLine/Src/Project/CLProj.c @@ -8,8 +8,7 @@ Boolean Proj_Initialize(Project *this) { } Boolean Proj_Terminate(Project *this) { -#line 25 - OPTION_ASSERT(this != NULL); + OS_ASSERT(25, this != NULL); Targets_Term(this->targets); return 1; diff --git a/command_line/CmdLine/Src/Project/CLSegs.c b/command_line/CmdLine/Src/Project/CLSegs.c index a0e006c..e2c7369 100644 --- a/command_line/CmdLine/Src/Project/CLSegs.c +++ b/command_line/CmdLine/Src/Project/CLSegs.c @@ -18,21 +18,18 @@ Boolean Segments_Initialize(Segments *segs) { Segment *main; UInt16 idx; -#line 36 - OPTION_ASSERT(segs != NULL); + OS_ASSERT(36, segs != NULL); memset(segs, 0, sizeof(Segments)); segs->segsArray = NULL; jump = Segment_New("Jump Table", 0x28); Segments_AddSegment(segs, jump, &idx); -#line 44 - OPTION_ASSERT(idx==0); + OS_ASSERT(44, idx==0); main = Segment_New("Main", 0xFFFF); Segments_AddSegment(segs, main, &idx); -#line 49 - OPTION_ASSERT(idx==1); + OS_ASSERT(49, idx==1); return 1; } @@ -40,8 +37,7 @@ Boolean Segments_Initialize(Segments *segs) { Boolean Segments_Terminate(Segments *segs) { UInt16 index; -#line 57 - OPTION_ASSERT(segs != NULL); + OS_ASSERT(57, segs != NULL); if (segs->segsArray) { for (index = 0; index < segs->segsCount; index++) @@ -56,8 +52,7 @@ Boolean Segments_Terminate(Segments *segs) { static Boolean Segments_GrowSegments(Segments *segs, UInt16 *index) { Segment **newArray; -#line 78 - OPTION_ASSERT(segs != NULL); + OS_ASSERT(78, segs != NULL); if (segs->segsCount >= segs->arraySize) { segs->arraySize += 20; @@ -106,8 +101,7 @@ Boolean Segments_DeleteSegment(Segments *segs, UInt16 index) { } Segment *Segments_GetSegment(Segments *segs, UInt16 segnum) { -#line 137 - OPTION_ASSERT(segs != NULL); + OS_ASSERT(137, segs != NULL); if (segnum < segs->segsCount) return segs->segsArray[segnum]; @@ -116,8 +110,7 @@ Segment *Segments_GetSegment(Segments *segs, UInt16 segnum) { } UInt16 Segments_Count(const Segments *segs) { -#line 147 - OPTION_ASSERT(segs != NULL); + OS_ASSERT(147, segs != NULL); return segs->segsCount; } -- cgit v1.2.3