DNA: ensure new names exist when renaming
Fail to build on errors in new names - without this renamed values would be written to DNA breaking backwards & forwards compatibility. Note that errors in old names aren't detected.
This commit is contained in:
@@ -33,6 +33,9 @@
|
||||
* All references to the previous destination name can be removed since they're
|
||||
* never written to disk.
|
||||
*
|
||||
* - Old names aren't sanity checked (since this file is the only place that knows about them)
|
||||
* typos in the old names will break both backwards & forwards compatibility **TAKE CARE**.
|
||||
*
|
||||
* \see versioning_dna.c for a actual version patching.
|
||||
*/
|
||||
|
||||
|
||||
@@ -1464,3 +1464,23 @@ int main(int argc, char **argv)
|
||||
/* end of list */
|
||||
|
||||
/** \} */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name DNA Renaming Sanity Check
|
||||
*
|
||||
* Without this it's possible to reference struct members that don't exist,
|
||||
* breaking backward & forward compatibility.
|
||||
*
|
||||
* \{ */
|
||||
|
||||
static void UNUSED_FUNCTION(dna_rename_defs_ensure)(void)
|
||||
{
|
||||
#define DNA_STRUCT_RENAME(old, new) (void)sizeof(new);
|
||||
#define DNA_STRUCT_RENAME_ELEM(struct_name, old, new) (void)offsetof(struct_name, new);
|
||||
#include "dna_rename_defs.h"
|
||||
#undef DNA_STRUCT_RENAME
|
||||
#undef DNA_STRUCT_RENAME_ELEM
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user