Fix ANSI C11 support.
This commit is contained in:
		@@ -74,7 +74,7 @@ library {
 | 
			
		||||
            link.linkerArgs = ['-lc', '-nodefaultlibs', '-flto']
 | 
			
		||||
        } else if (toolChain in VisualCpp) {
 | 
			
		||||
            // TODO: Should this be shared instead of static?
 | 
			
		||||
            compile.compilerArgs = ['/TC', '/MT', '/Ox', '/DSODIUM_STATIC', '/DSODIUM_EXPORT=']
 | 
			
		||||
            compile.compilerArgs = ['/TC', '/MT', '/Ox', '/DSODIUM_STATIC', '/DSODIUM_EXPORT=', '/std:c11']
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -250,7 +250,7 @@ void mpw_marshal_file_free(
 | 
			
		||||
MPMarshalledData *mpw_marshal_data_new() {
 | 
			
		||||
 | 
			
		||||
    MPMarshalledData *data = malloc( sizeof( MPMarshalledData ) );
 | 
			
		||||
    *data = (MPMarshalledData){};
 | 
			
		||||
    *data = (MPMarshalledData){ 0 };
 | 
			
		||||
    mpw_marshal_data_set_null( data, NULL );
 | 
			
		||||
    data->is_null = false;
 | 
			
		||||
    return data;
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,6 @@ MP_LIBS_BEGIN
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <libgen.h>
 | 
			
		||||
 | 
			
		||||
#if MPW_CPERCIVA
 | 
			
		||||
#include <scrypt/crypto_scrypt.h>
 | 
			
		||||
 
 | 
			
		||||
@@ -86,6 +86,21 @@ void mpw_log_ssink(LogLevel level, const char *file, int line, const char *funct
 | 
			
		||||
 | 
			
		||||
//// Utilities
 | 
			
		||||
 | 
			
		||||
#ifndef OK
 | 
			
		||||
#define OK 0
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ERR
 | 
			
		||||
#define ERR -1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef stringify
 | 
			
		||||
#define stringify(s) #s
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef stringify_def
 | 
			
		||||
#define stringify_def(s) stringify(s)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !__STRICT_ANSI__ && __GNUC__ >= 3
 | 
			
		||||
#ifndef min
 | 
			
		||||
#define min(a, b) ({ \
 | 
			
		||||
    __typeof__ (a) _a = (a); \
 | 
			
		||||
@@ -98,21 +113,18 @@ void mpw_log_ssink(LogLevel level, const char *file, int line, const char *funct
 | 
			
		||||
    __typeof__ (b) _b = (b); \
 | 
			
		||||
    _a > _b ? _a : _b; })
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef ERR
 | 
			
		||||
#define ERR -1
 | 
			
		||||
#define mpw_default(__default, __value) ({ __typeof__ (__value) _v = (__value); _v? _v: (__default); })
 | 
			
		||||
#define mpw_default_n(__default, __num) ({ __typeof__ (__num) _n = (__num); !isnan( _n )? (__typeof__ (__default))_n: (__default); })
 | 
			
		||||
#else
 | 
			
		||||
#ifndef min
 | 
			
		||||
#define min(a, b) ( (a) < (b) ? (a) : (b) )
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef OK
 | 
			
		||||
#define OK 0
 | 
			
		||||
#ifndef max
 | 
			
		||||
#define max(a, b) ( (a) > (b) ? (a) : (b) )
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef stringify
 | 
			
		||||
#define stringify(s) #s
 | 
			
		||||
#define mpw_default(__default, __value) ( (__value)? (__value): (__default) )
 | 
			
		||||
#define mpw_default_n(__default, __num) ( !isnan( (__num) )? (__num): (__default) )
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef stringify_def
 | 
			
		||||
#define stringify_def(s) stringify(s)
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define mpw_default(__default, __value) ({ __typeof__ (__value) _v = __value; _v? _v: __default; })
 | 
			
		||||
#define mpw_default_n(__default, __num) ({ __typeof__ (__num) _n = (__num); !isnan( _n )? (__typeof__ (__default))_n: __default; })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//// Buffers and memory.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user