1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 16:29:58 +00:00

Allow for warning-free build of common with MS VC on warning level 3.

This commit is contained in:
Oliver Schmidt 2013-04-07 22:19:23 +02:00
parent 365668785c
commit ffb8595440
4 changed files with 12 additions and 6 deletions

View File

@ -99,7 +99,7 @@ Float FP_F_FromInt (long Val)
/* Convert an integer into a floating point variable */ /* Convert an integer into a floating point variable */
{ {
Float D; Float D;
D.V = Val; D.V = (float) Val;
return D; return D;
} }
@ -164,7 +164,7 @@ size_t FP_D_Size (void)
unsigned char* FP_D_Data (Double Val) unsigned char* FP_D_Data (Double Val)
/* Return the raw data of a double in a malloc'ed buffer. Free after use. */ /* Return the raw data of a double in a malloc'ed buffer. Free after use. */
{ {
float F = Val.V; float F = (float) Val.V;
return memcpy (xmalloc (F_SIZE), &F, F_SIZE); return memcpy (xmalloc (F_SIZE), &F, F_SIZE);
} }

View File

@ -39,11 +39,11 @@
/* If we have stdint.h, include it, otherwise try some quesswork on types. /* If we have stdint.h, include it, otherwise try some quesswork on types.
* gcc doesn't define __STDC_VERSION__ without special flags, so check for * gcc and msvc don't define __STDC_VERSION__ without special flags, so check
* gcc explicitly. Undefined symbols are replaced by zero, so a check for * for them explicitly. Undefined symbols are replaced by zero, so a check for
* defined(__GNUC__) is not necessary. * defined(__GNUC__) or defined(_MSC_VER) is not necessary.
*/ */
#if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) #if (__STDC_VERSION__ >= 199901) || (__GNUC__ >= 3) || (_MSC_VER >= 1600)
#include <stdint.h> #include <stdint.h>
#else #else

View File

@ -38,6 +38,7 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* Microsoft compiler */ /* Microsoft compiler */
# include <io.h> # include <io.h>
# pragma warning(disable : 4996)
#else #else
/* Anyone else */ /* Anyone else */
# include <unistd.h> # include <unistd.h>

View File

@ -57,6 +57,11 @@
#define va_copy(dest,src) __va_copy(dest, src) #define va_copy(dest,src) __va_copy(dest, src)
#endif #endif
/* MS VC allows for assignment */
#if defined(_MSC_VER)
#define va_copy(dest,src) ((dest) = (src))
#endif
/* If va_copy is not defined now, we have a problem */ /* If va_copy is not defined now, we have a problem */
#if !defined(va_copy) #if !defined(va_copy)
#error "Need a working va_copy!" #error "Need a working va_copy!"