Worldstone
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
Platform.h File Reference

Platform specific tools and macros. More...

#include <intrin.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define WS_PLATFORM_WINDOWS
 Defined if we are building for Windows.
 
#define WS_PLATFORM_LINUX
 Defined if we are building for Linux.
 
#define WS_PLATFORM_MAC
 Defined if we are building for Mac based platform (OSX,iOS...)
 
#define WS_PLATFORM_IOS
 Defined if we are building for iOS.
 
#define WS_PLATFORM_EMSCRIPTEN
 Defined if we are building for Emscripten.
 
#define WS_STRINGIZE(_x)   #_x
 
#define WS_FALLTHROUGH   ((void)0)
 Equivalent to the [[fallthrough]] attribute when supported Used to annotate implicit fallthroughs in a switch. More...
 
Compiler defines
#define WS_GCC_FAMILY
 Defined if we are using gcc/clang or any gnuc compatible compiler.
 
#define WS_CLANG
 Defined if the compiler is clang.
 
#define WS_GCC
 Defined if the compiler is GCC (not clang)
 
#define WS_MSC
 Defined if compiling using MS visual compiler (Cl.exe)
 
#define WS_64BITS
 Defined if compiling for a 64-bits architecture.
 
#define WS_32BITS
 Defined if compiling for a 32-bits architecture.
 
#define WS_32BITS
 Defined if compiling for a 32-bits architecture.
 
Macros to silence warnings

Here is a sample on how to use those macros

WS_PRAGMA_DIAGNOSTIC_IGNORED_GNU("-Wunused-parameter")
WS_PRAGMA_DIAGNOSTIC_IGNORED_MSC(4100) // warning C4100: '' : unreferenced formal parameter
#define WS_PRAGMA_DIAGNOSTIC_PUSH()
 Saves the current state of the compiler warnings.
 
#define WS_PRAGMA_DIAGNOSTIC_POP()
 Restores the previous state of the compiler warnings.
 
#define WS_PRAGMA_DIAGNOSTIC_IGNORED_GNU(_x)
 Silence GCC/clang-specific warnings.
 
#define WS_PRAGMA_DIAGNOSTIC_IGNORED_GCC(_x)
 Silence GCC-specific warnings.
 
#define WS_PRAGMA_DIAGNOSTIC_IGNORED_CLANG(_x)
 Silence clang-specific warnings.
 
#define WS_PRAGMA_DIAGNOSTIC_IGNORED_MSC(_x)
 Silence MSC-specific warnings.
 

Functions

constexpr size_t operator""_z (unsigned long long int n)
 Types support. More...
 

Detailed Description

Platform specific tools and macros.

Author
Lectem

Definition in file Platform.h.

Macro Definition Documentation

#define WS_FALLTHROUGH   ((void)0)

Equivalent to the [[fallthrough]] attribute when supported Used to annotate implicit fallthroughs in a switch.

Here is an example:

switch(foo)
{
case 0:
doSomething();
case 1:
doSomethingForBothCase0and1();
break;
default:
break;
}

Definition at line 157 of file Platform.h.

Function Documentation

constexpr size_t operator""_z ( unsigned long long int  n)

Types support.

User litteral for size_t (ie: size_t s = 10_z)

Returns
The integer value as a size_t

Definition at line 169 of file Platform.h.