From 66b40d1a84d2e629645af5c4b4e145f011cd0a10 Mon Sep 17 00:00:00 2001 From: cuz Date: Sat, 19 Aug 2000 18:16:54 +0000 Subject: [PATCH] Use more gcc attributes git-svn-id: svn://svn.cc65.org/cc65/trunk@289 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/common/bitops.h | 10 +++++++--- src/common/cmdline.c | 2 +- src/common/cmdline.h | 14 +++++++++----- src/common/hashstr.h | 8 ++++++-- src/common/make/gcc.mak | 3 ++- src/common/make/watcom.mak | 1 + 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/common/bitops.h b/src/common/bitops.h index 8786fd016..af39a2e0f 100644 --- a/src/common/bitops.h +++ b/src/common/bitops.h @@ -38,13 +38,17 @@ +#include "attrib.h" + + + /*****************************************************************************/ /* Code */ /*****************************************************************************/ -unsigned BitFind (unsigned long Val); +unsigned BitFind (unsigned long Val) attribute ((const)); /* Find the first bit that is set in Val. Val must *not* be zero */ void BitSet (void* Data, unsigned Bit); @@ -53,10 +57,10 @@ void BitSet (void* Data, unsigned Bit); void BitReset (void* Data, unsigned Bit); /* Reset a bit in a char array */ -int BitIsSet (void* Data, unsigned Bit); +int BitIsSet (void* Data, unsigned Bit) attribute ((const)); /* Check if a bit is set in a char array */ -int BitIsReset (void* Data, unsigned Bit); +int BitIsReset (void* Data, unsigned Bit) attribute ((const)); /* Check if a bit is reset in a char array */ void BitMerge (void* Target, const void* Source, unsigned Size); diff --git a/src/common/cmdline.c b/src/common/cmdline.c index 3403cdd7c..b12feb7c0 100644 --- a/src/common/cmdline.c +++ b/src/common/cmdline.c @@ -95,7 +95,7 @@ void InitCmdLine (unsigned aArgCount, char* aArgVec[], const char* aProgName) void UnknownOption (const char* Opt) -/* Print an error about an unknown option. */ +/* Print an error about an unknown option and die. */ { AbEnd ("Unknown option: %s\n", Opt); } diff --git a/src/common/cmdline.h b/src/common/cmdline.h index 1173e10b6..bb582e451 100644 --- a/src/common/cmdline.h +++ b/src/common/cmdline.h @@ -38,6 +38,10 @@ +#include "attrib.h" + + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ @@ -69,13 +73,13 @@ void InitCmdLine (unsigned aArgCount, char* aArgVec[], const char* aProgName); * array. Both arguments are remembered in static storage. */ -void UnknownOption (const char* Opt); -/* Print an error about an unknown option. */ +void UnknownOption (const char* Opt) attribute ((noreturn)); +/* Print an error about an unknown option and die. */ -void NeedArg (const char* Opt); +void NeedArg (const char* Opt) attribute ((noreturn)); /* Print an error about a missing option argument and exit. */ -void InvDef (const char* Def); +void InvDef (const char* Def) attribute ((noreturn)); /* Print an error about an invalid definition and die */ const char* GetArg (int* ArgNum, unsigned Len); @@ -91,6 +95,6 @@ void LongOption (int* ArgNum, const LongOpt* OptTab, unsigned OptCount); /* End of cmdline.h */ #endif - + diff --git a/src/common/hashstr.h b/src/common/hashstr.h index af7f2796c..21d1ef3b4 100644 --- a/src/common/hashstr.h +++ b/src/common/hashstr.h @@ -38,13 +38,17 @@ +#include "attrib.h" + + + /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ -unsigned HashStr (const char* S); +unsigned HashStr (const char* S) attribute ((const)); /* Return a hash value for the given string */ diff --git a/src/common/make/gcc.mak b/src/common/make/gcc.mak index 26c2e8ccd..6da3bd4ac 100644 --- a/src/common/make/gcc.mak +++ b/src/common/make/gcc.mak @@ -13,6 +13,7 @@ OBJS = abend.o \ bitops.o \ check.o \ cmdline.o \ + coll.o \ exprdefs.o \ fname.o \ hashstr.o \ @@ -53,4 +54,4 @@ depend dep: $(OBJS:.o=.c) $(CC) -MM $^ > .depend - + diff --git a/src/common/make/watcom.mak b/src/common/make/watcom.mak index e8caa558f..ce3640489 100644 --- a/src/common/make/watcom.mak +++ b/src/common/make/watcom.mak @@ -69,6 +69,7 @@ OBJS = abend.obj \ bitops.obj \ check.obj \ cmdline.obj \ + coll.obj \ exprdefs.obj \ fname.obj \ hashstr.obj \ -- 2.39.5