diff options
author | Nebuleon <nebuleon@alakazam> | 2017-03-26 05:14:49 +0000 |
---|---|---|
committer | Nebuleon <nebuleon@alakazam> | 2017-03-27 02:01:35 +0000 |
commit | c70f96f253ffe13c14d002853b665765a50e85bc (patch) | |
tree | c1f65762905208b2ad1a3bbde7e0e9891e7a46e2 | |
parent | 17ed1eb30f824772794c129cb810c52782b9c7f7 (diff) | |
download | ReGBA-c70f96f253ffe13c14d002853b665765a50e85bc.zip ReGBA-c70f96f253ffe13c14d002853b665765a50e85bc.tar.gz ReGBA-c70f96f253ffe13c14d002853b665765a50e85bc.tar.bz2 |
Add a macro to declare variables with wasteful zero-initialisation
The DSTwo port implements this to move those variables into the
.noinit section.
-rw-r--r-- | source/common.h | 6 | ||||
-rw-r--r-- | source/dstwo/port.h | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/source/common.h b/source/common.h index a58e197..dc916e6 100644 --- a/source/common.h +++ b/source/common.h @@ -137,6 +137,12 @@ typedef uint32_t FIXED16_16; // Q16.16 fixed-point #include "port.h" +/* If the port didn't give a way to declare a variable as fully uninitialised + * (when zero-initialisation is wasteful), declare them normally. */ +#ifndef FULLY_UNINITIALIZED +# define FULLY_UNINITIALIZED(declarator) declarator +#endif + #include "cpu.h" #include "memory.h" #include "video.h" diff --git a/source/dstwo/port.h b/source/dstwo/port.h index fa630bb..42e5c4c 100644 --- a/source/dstwo/port.h +++ b/source/dstwo/port.h @@ -94,4 +94,7 @@ extern const char* GetFileName(const char* Path); extern void RemoveExtension(char* Result, const char* FileName); extern void GetFileNameNoExtension(char* Result, const char* Path); +#define FULLY_UNINITIALIZED(declarator) \ + declarator __attribute__((section(".noinit"))) + #endif |