Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MorsGames
GitHub Repository: MorsGames/sm64plus
Path: blob/master/src/goddard/bad_declarations.h
7858 views
1
#ifndef GD_BAD_DECLARATIONS_H
2
#define GD_BAD_DECLARATIONS_H
3
4
#include "gd_types.h"
5
6
/**
7
* @file bad_declarations.h
8
*
9
* Match incorrect type promotion for two declared functions.
10
*
11
* There is an issue with the compiled code for these function calls in files
12
* outside of the files in which they were defined: instead of passing f32's,
13
* the caller passes f64's.
14
*
15
* The only possible reason I can come up with for this behavior is that
16
* goddard only declared (not prototyped) his functions in the headers,
17
* and didn't include the header in the function's defining .c file.
18
* (Even IDO 5.3 cares about illegal promotion of types!) This results in
19
* default argument promotion, which is incorrect in this case.
20
*
21
* Since that's an awful practice to emulate, include this file (first!) to prevent
22
* the proper prototypes of these functions from being seen by files with the
23
* the incorrectly compiled calls.
24
*/
25
26
#ifndef AVOID_UB
27
28
#define GD_USE_BAD_DECLARATIONS
29
30
/* shape_helper.h */
31
extern struct ObjFace *make_face_with_colour();
32
/* should be: make_face_with_colour(f32, f32, f32) */
33
34
/* old_menu.h */
35
extern struct ObjLabel *make_label();
36
/* should be: make_label(struct ObjValPtr *, char *, s32, f32, f32, f32) */
37
38
#endif /* !AVOID_UB */
39
40
#endif // GD_BAD_DECLARATIONS_H
41
42