#include <stdarg.h>
#include <ctype.h>
+/*
+ * Disable some over protective warnings in visual studio because fixing them is a waste
+ * of my time.
+ */
+#ifdef _MSC_VER
+# pragma warning(disable : 4244 ) // conversion from 'int' to 'float', possible loss of data
+# pragma warning(disable : 4018 ) // signed/unsigned mismatch
+# pragma warning(disable : 4996 ) // This function or variable may be unsafe
+# pragma warning(disable : 4700 ) // uninitialized local variable used
+#endif
+
#define GMQCC_VERSION_MAJOR 0
#define GMQCC_VERSION_MINOR 1
#define GMQCC_VERSION_PATCH 0
#if INT_MAX == 0x7FFFFFFF
typedef int int32_t;
typedef unsigned int uint32_t;
- typedef long int64_t;
- typedef unsigned long uint64_t;
#elif LONG_MAX == 0x7FFFFFFF
typedef long int32_t;
typedef unsigned long uint32_t;
+#endif
+
+#if defined(__GNUC__) || defined (__CLANG__)
+ typedef int int64_t __attribute__((__mode__(__DI__)));
+ typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
+#elif defined(_MSC_VER)
+ typedef __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+#else
/*
- * It's nearly impossible to figure out a 64bit type at
- * this point without making assumptions about the build
- * enviroment. So if clang or gcc is detected use some
- * compiler builtins to create a 64 signed and unsigned
- * type.
- */
-# if defined(__GNUC__) || defined (__CLANG__)
- typedef int int64_t __attribute__((__mode__(__DI__)));
- typedef unsigned int uint64_t __attribute__((__mode__(__DI__)));
-# else
- /*
- * Incoorectly size the types so static assertions below will
- * fail. There is no valid way to get a 64bit type at this point
- * without making assumptions of too many things.
- */
- typedef struct { char _fail : 0; } int64_t;
- typedef struct { char _fail : 0; } uint64_t;
-# endif
+ * Incoorectly size the types so static assertions below will
+ * fail. There is no valid way to get a 64bit type at this point
+ * without making assumptions of too many things.
+ */
+ typedef struct { char _fail : 0; } int64_t;
+ typedef struct { char _fail : 0; } uint64_t;
#endif
#ifdef _LP64 /* long pointer == 64 */
typedef unsigned long uintptr_t;
typedef char uint64_size_is_correct [sizeof(uint64_t) == 8?1:-1];
typedef char int16_size_if_correct [sizeof(int16_t) == 2?1:-1];
typedef char int32_size_is_correct [sizeof(int32_t) == 4?1:-1];
-typedef char int64_size_is_correct [sizeof(int64_t) == 8?1:-1];
+typedef char int64_size_is_correct [sizeof(int64_t) >= 8?1:-1];
/* intptr_t / uintptr_t correct size check */
typedef char uintptr_size_is_correct[sizeof(intptr_t) == sizeof(int*)?1:-1];
typedef char intptr_size_is_correct [sizeof(uintptr_t)== sizeof(int*)?1:-1];
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Debug|Win32">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|Win32">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>Win32</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{85C266A8-7938-4AE6-AB64-428DC32B1ACD}</ProjectGuid>\r
+ <RootNamespace>gmqcc</RootNamespace>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ <CharacterSet>NotSet</CharacterSet>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+ <ConfigurationType>Application</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <CharacterSet>NotSet</CharacterSet>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <OutDir>.\</OutDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <IntDir>.\</IntDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <TargetName>gmqcc</TargetName>\r
+ <GenerateManifest>false</GenerateManifest>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <OutDir>.</OutDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <IntDir>.</IntDir>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <TargetName>gmqcc</TargetName>\r
+ <GenerateManifest>false</GenerateManifest>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>Disabled</Optimization>\r
+ <AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <ExceptionHandling>false</ExceptionHandling>\r
+ <BufferSecurityCheck>false</BufferSecurityCheck>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <PrecompiledHeaderFile>\r
+ </PrecompiledHeaderFile>\r
+ <PrecompiledHeaderOutputFile>\r
+ </PrecompiledHeaderOutputFile>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <ManifestFile>\r
+ </ManifestFile>\r
+ <ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>\r
+ <SubSystem>Console</SubSystem>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+ <ClCompile>\r
+ <WarningLevel>Level3</WarningLevel>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <FunctionLevelLinking>true</FunctionLevelLinking>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <AdditionalIncludeDirectories>.\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <ExceptionHandling>false</ExceptionHandling>\r
+ <BufferSecurityCheck>false</BufferSecurityCheck>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <PrecompiledHeaderFile>\r
+ </PrecompiledHeaderFile>\r
+ <PrecompiledHeaderOutputFile>\r
+ </PrecompiledHeaderOutputFile>\r
+ </ClCompile>\r
+ <Link>\r
+ <GenerateDebugInformation>true</GenerateDebugInformation>\r
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+ <OptimizeReferences>true</OptimizeReferences>\r
+ <ManifestFile>\r
+ </ManifestFile>\r
+ <ProgramDatabaseFile>$(TargetName).pdb</ProgramDatabaseFile>\r
+ <SubSystem>Console</SubSystem>\r
+ </Link>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="asm.c" />\r
+ <ClCompile Include="ast.c" />\r
+ <ClCompile Include="code.c" />\r
+ <ClCompile Include="error.c" />\r
+ <ClCompile Include="exec.c" />\r
+ <ClCompile Include="ir.c" />\r
+ <ClCompile Include="lexer.c" />\r
+ <ClCompile Include="main.c" />\r
+ <ClCompile Include="parser.c" />\r
+ <ClCompile Include="util.c" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="ast.h" />\r
+ <ClInclude Include="execloop.h" />\r
+ <ClInclude Include="gmqcc.h" />\r
+ <ClInclude Include="ir.h" />\r
+ <ClInclude Include="lexer.h" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <None Include="flags.def" />\r
+ <None Include="warns.def" />\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file