From: Greg King Date: Mon, 22 Jun 2015 04:15:48 +0000 (-0400) Subject: Added explicit settings of calling conventions in pointer-to-function declarations... X-Git-Tag: V2.15~1^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=refs%2Fpull%2F161%2Fhead;p=cc65 Added explicit settings of calling conventions in pointer-to-function declarations in system and library headers. --- diff --git a/include/stdlib.h b/include/stdlib.h index eac5629a8..3103172d8 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -107,12 +107,12 @@ int __fastcall__ atoi (const char* s); long __fastcall__ atol (const char* s); int __fastcall__ atexit (void (*exitfunc) (void)); void* __fastcall__ bsearch (const void* key, const void* base, size_t n, - size_t size, int (*cmp) (const void*, const void*)); + size_t size, int __fastcall__ (* cmp) (const void*, const void*)); div_t __fastcall__ div (int numer, int denom); void __fastcall__ exit (int ret) __attribute__ ((noreturn)); char* __fastcall__ getenv (const char* name); void __fastcall__ qsort (void* base, size_t count, size_t size, - int (*compare) (const void*, const void*)); + int __fastcall__ (* compare) (const void*, const void*)); long __fastcall__ strtol (const char* nptr, char** endptr, int base); unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base); int __fastcall__ system (const char* s); diff --git a/libsrc/common/_printf.h b/libsrc/common/_printf.h index ffb2443bd..7914fa870 100644 --- a/libsrc/common/_printf.h +++ b/libsrc/common/_printf.h @@ -16,7 +16,7 @@ struct outdesc; /* Type of the function that is called to output data */ -typedef void (*outfunc) (struct outdesc* desc, const char* buf, unsigned count); +typedef void __cdecl__ (* outfunc) (struct outdesc* desc, const char* buf, unsigned count); diff --git a/libsrc/common/bsearch.c b/libsrc/common/bsearch.c index f6d32a5b5..aafd28592 100644 --- a/libsrc/common/bsearch.c +++ b/libsrc/common/bsearch.c @@ -1,7 +1,8 @@ /* ** bsearch.c ** -** Ullrich von Bassewitz, 17.06.1998 +** 1998-06-17, Ullrich von Bassewitz +** 2015-06-21, Greg King */ @@ -11,7 +12,7 @@ void* __fastcall__ bsearch (const void* key, const void* base, size_t n, - size_t size, int (*cmp) (const void*, const void*)) + size_t size, int __fastcall__ (* cmp) (const void*, const void*)) { int current; int result; diff --git a/libsrc/common/qsort.c b/libsrc/common/qsort.c index df02095ed..991db3ba1 100644 --- a/libsrc/common/qsort.c +++ b/libsrc/common/qsort.c @@ -1,7 +1,8 @@ /* ** qsort.c ** -** Ullrich von Bassewitz, 09.12.1998 +** 1998.12.09, Ullrich von Bassewitz +** 2015-06-21, Greg King */ @@ -12,7 +13,7 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi, register size_t Size, - int (*Compare)(const void*, const void*)) + int __fastcall__ (* Compare) (const void*, const void*)) /* Internal recursive function. Works with ints, but this shouldn't be ** a problem. */ @@ -52,7 +53,7 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi, void __fastcall__ qsort (void* base, size_t nmemb, size_t size, - int (*compare)(const void*, const void*)) + int __fastcall__ (* compare) (const void*, const void*)) /* Quicksort implementation */ { if (nmemb > 1) { diff --git a/libsrc/common/vfprintf.s b/libsrc/common/vfprintf.s index 9812f661b..1225bcc47 100644 --- a/libsrc/common/vfprintf.s +++ b/libsrc/common/vfprintf.s @@ -33,7 +33,7 @@ ptr: .res 2 ; Points to output file ; can ignore the passed pointer d, and access the data directly. While this ; is not very clean, it gives better and shorter code. ; -; static void out (struct outdesc* d, const char* buf, unsigned count) +; static void cdecl out (struct outdesc* d, const char* buf, unsigned count) ; /* Routine used for writing */ ; { ; register size_t cnt; @@ -56,7 +56,7 @@ out: ldy #5 ldy #7 jsr pushwysp ; Push count lda ptr - ldx ptr+1 + ldx ptr+1 jsr _fwrite sta ptr1 ; Save function result stx ptr1+1 diff --git a/libsrc/common/vsnprintf.s b/libsrc/common/vsnprintf.s index db82bdaf3..a8ed50e06 100644 --- a/libsrc/common/vsnprintf.s +++ b/libsrc/common/vsnprintf.s @@ -1,5 +1,5 @@ ; -; int vsnprintf (char* Buf, size_t size, const char* Format, va_list ap); +; int __fastcall__ vsnprintf (char* Buf, size_t size, const char* Format, va_list ap); ; ; Ullrich von Bassewitz, 2009-09-26 ; @@ -130,7 +130,7 @@ L9: pla ; ---------------------------------------------------------------------------- ; Callback routine used for the actual output. ; -; static void out (struct outdesc* d, const char* buf, unsigned count) +; static void __cdecl__ out (struct outdesc* d, const char* buf, unsigned count) ; /* Routine used for writing */ ; ; Since we know, we're called with a pointer to our static outdesc structure,