History

win64: defined size_t and ptrdiff_t to unsigned long long

grischka committed 16 years ago

Commit e20bf691 parent b0abcfd3 files · +43 −31Browse files

Unified · Split

3 files
  1. include/stddef.h +14 −6
  2. libtcc.c +12 −7
  3. win32/include/_mingw.h +17 −18
include/stddef.h+14−6
@@ -1,20 +1,28 @@
1#ifndef _STDDEF_H1#ifndef _STDDEF_H
2#define _STDDEF_H2#define _STDDEF_H
3 3
4#define NULL ((void *)0)
5typedef __SIZE_TYPE__ size_t;4typedef __SIZE_TYPE__ size_t;
5typedef __PTRDIFF_TYPE__ ssize_t;
6typedef __WCHAR_TYPE__ wchar_t;6typedef __WCHAR_TYPE__ wchar_t;
7typedef __PTRDIFF_TYPE__ ptrdiff_t;7typedef __PTRDIFF_TYPE__ ptrdiff_t;
8#define offsetof(type, field) ((size_t) &((type *)0)->field)8typedef __PTRDIFF_TYPE__ intptr_t;
9typedef __SIZE_TYPE__ uintptr_t;
9 10
10#ifndef __int8_t_defined11#ifndef __int8_t_defined
11#define __int8_t_defined12#define __int8_t_defined
12typedef char int8_t;13typedef signed char int8_t;
13typedef short int int16_t;14typedef signed short int int16_t;
14typedef int int32_t;15typedef signed int int32_t;
15typedef long long int int64_t;16typedef signed long long int int64_t;
17typedef unsigned char uint8_t;
18typedef unsigned short int uint16_t;
19typedef unsigned int uint32_t;
20typedef unsigned long long int uint64_t;
16#endif21#endif
17 22
23#define NULL ((void *)0)
24#define offsetof(type, field) ((size_t)&((type *)0)->field)
25
18void *alloca(size_t size);26void *alloca(size_t size);
19 27
20#endif28#endif
libtcc.c+12−7
@@ -886,9 +886,9 @@ LIBTCCAPI TCCState *tcc_new(void) · 885 unmodified lines
886 tcc_define_symbol(s, "__STDC__", NULL);886 tcc_define_symbol(s, "__STDC__", NULL);
887 tcc_define_symbol(s, "__STDC_VERSION__", "199901L");887 tcc_define_symbol(s, "__STDC_VERSION__", "199901L");
888#if defined(TCC_TARGET_I386)888#if defined(TCC_TARGET_I386)
889 tcc_define_symbol(s, "__i386__", "1");889 tcc_define_symbol(s, "__i386__", NULL);
890 tcc_define_symbol(s, "__i386", "1");890 tcc_define_symbol(s, "__i386", NULL);
891 tcc_define_symbol(s, "i386", "1");891 tcc_define_symbol(s, "i386", NULL);
892#endif892#endif
893#if defined(TCC_TARGET_X86_64)893#if defined(TCC_TARGET_X86_64)
894 tcc_define_symbol(s, "__x86_64__", NULL);894 tcc_define_symbol(s, "__x86_64__", NULL);
@@ -909,13 +909,12 @@ LIBTCCAPI TCCState *tcc_new(void) · 14 unmodified lines
909 tcc_define_symbol(s, "_WIN64", NULL);909 tcc_define_symbol(s, "_WIN64", NULL);
910#endif910#endif
911#else911#else
912 tcc_define_symbol(s, "__unix__", "1");912 tcc_define_symbol(s, "__unix__", NULL);
913 tcc_define_symbol(s, "__unix", "1");913 tcc_define_symbol(s, "__unix", NULL);
914 tcc_define_symbol(s, "unix", "1");914 tcc_define_symbol(s, "unix", NULL);
915#if defined(__FreeBSD__)915#if defined(__FreeBSD__)
916#define str(s) #s916#define str(s) #s
917 tcc_define_symbol(s, "__FreeBSD__", str( __FreeBSD__));917 tcc_define_symbol(s, "__FreeBSD__", str( __FreeBSD__));
918 tcc_define_symbol(s, "__INTEL_COMPILER", "1");
919#undef str918#undef str
920#endif919#endif
921#if defined(__linux)920#if defined(__linux)
@@ -929,8 +928,14 @@ LIBTCCAPI TCCState *tcc_new(void) · 7 unmodified lines
929 tcc_define_symbol(s, "__TINYC__", buffer);928 tcc_define_symbol(s, "__TINYC__", buffer);
930 929
931 /* tiny C & gcc defines */930 /* tiny C & gcc defines */
931#if defined TCC_TARGET_PE && defined TCC_TARGET_X86_64
932 tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long long");
933 tcc_define_symbol(s, "__PTRDIFF_TYPE__", "long long");
934#else
932 tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long");935 tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long");
933 tcc_define_symbol(s, "__PTRDIFF_TYPE__", "long");936 tcc_define_symbol(s, "__PTRDIFF_TYPE__", "long");
937#endif
938
934#ifdef TCC_TARGET_PE939#ifdef TCC_TARGET_PE
935 tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");940 tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");
936#else941#else
win32/include/_mingw.h+17−18
@@ -58,28 +58,27 @@ · 57 unmodified lines
58#define _CRT_WIDE(_String) __CRT_WIDE(_String)58#define _CRT_WIDE(_String) __CRT_WIDE(_String)
59 59
60#ifdef _WIN6460#ifdef _WIN64
61# define _INTEGRAL_MAX_BITS 6461#define __stdcall
62typedef __int64 intptr_t;62#define _AMD64_ 1
63typedef __int64 ptrdiff_t;63#define __x86_64 1
64typedef unsigned __int64 uintptr_t;64#define USE_MINGW_SETJMP_TWO_ARGS
65# define __stdcall65#define mingw_getsp tinyc_getbp
66# define _AMD64_ 1
67# define __x86_64 1
68# define USE_MINGW_SETJMP_TWO_ARGS
69# define mingw_getsp tinyc_getbp
70#else66#else
71# define _INTEGRAL_MAX_BITS 3267#define __stdcall __attribute__((__stdcall__))
72typedef __int32 intptr_t;68#define _X86_ 1
73typedef __int32 ptrdiff_t;69#define WIN32 1
74typedef unsigned __int32 uintptr_t;70#define _USE_32BIT_TIME_T
75# define __stdcall __attribute__((__stdcall__))
76# define _X86_ 1
77# define WIN32 1
78# define _USE_32BIT_TIME_T
79#endif71#endif
72
73/* in stddef.h */
74#define _SIZE_T_DEFINED
75#define _SSIZE_T_DEFINED
76#define _PTRDIFF_T_DEFINED
77#define _WCHAR_T_DEFINED
80#define _UINTPTR_T_DEFINED78#define _UINTPTR_T_DEFINED
81#define _INTPTR_T_DEFINED79#define _INTPTR_T_DEFINED
82#define _PTRDIFF_T_DEFINED80
81#define _INTEGRAL_MAX_BITS 64
83 82
84typedef long __time32_t;83typedef long __time32_t;
85#define _TIME32_T_DEFINED84#define _TIME32_T_DEFINED

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t