Skip to content

Commit

Permalink
Remove ALIGN, PACKED, and rename DEPRECATED
Browse files Browse the repository at this point in the history
The mitigates compatibility issues with other libraries, such as the one seen in devkitPro#530.

The `BIT` macro is kept because it is commonly used, so removing it
would be too breaking of a change (see
devkitPro#531 (comment))

Fixes devkitPro#530
  • Loading branch information
glebm committed Sep 12, 2023
1 parent a4634c0 commit b9cb403
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion libctru/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2023,7 +2023,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED = PACKED
PREDEFINED =

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
2 changes: 1 addition & 1 deletion libctru/include/3ds/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void gfxScreenSwapBuffers(gfxScreen_t scr, bool hasStereo);
* @param immediate This parameter no longer has any effect and is thus ignored.
* @deprecated This function has been superseded by \ref gfxScreenSwapBuffers, please use that instead.
*/
DEPRECATED void gfxConfigScreen(gfxScreen_t scr, bool immediate);
LIBCTRU_DEPRECATED void gfxConfigScreen(gfxScreen_t scr, bool immediate);

/**
* @brief Updates the configuration of both screens.
Expand Down
2 changes: 1 addition & 1 deletion libctru/include/3ds/ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static inline u32 IPC_Desc_CurProcessId(void)
return 0x20;
}

static inline DEPRECATED u32 IPC_Desc_CurProcessHandle(void)
static inline LIBCTRU_DEPRECATED u32 IPC_Desc_CurProcessHandle(void)
{
return IPC_Desc_CurProcessId();
}
Expand Down
2 changes: 1 addition & 1 deletion libctru/include/3ds/services/apt.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ bool aptShouldJumpToHome(void);
bool aptCheckHomePressRejected(void);

/// \deprecated Alias for \ref aptCheckHomePressRejected.
static inline DEPRECATED bool aptIsHomePressed(void)
static inline LIBCTRU_DEPRECATED bool aptIsHomePressed(void)
{
return aptCheckHomePressRejected();
}
Expand Down
11 changes: 3 additions & 8 deletions libctru/include/3ds/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,12 @@ typedef void (*voidfn)(void);
/// Creates a bitmask from a bit number.
#define BIT(n) (1U<<(n))

/// Aligns a struct (and other types?) to m, making sure that the size of the struct is a multiple of m.
#define ALIGN(m) __attribute__((aligned(m)))
/// Packs a struct (and other types?) so it won't include padding bytes.
#define PACKED __attribute__((packed))

#ifndef LIBCTRU_NO_DEPRECATION
/// Flags a function as deprecated.
#define DEPRECATED __attribute__ ((deprecated))
#define LIBCTRU_DEPRECATED __attribute__ ((deprecated))
#else
/// Flags a function as deprecated.
#define DEPRECATED
#define LIBCTRU_DEPRECATED
#endif

/// Structure representing CPU registers
Expand All @@ -71,7 +66,7 @@ typedef struct {
/// Structure representing FPU registers
typedef struct {
union {
struct PACKED { double d[16]; }; ///< d0-d15.
struct __attribute__((packed)) { double d[16]; }; ///< d0-d15.
float s[32]; ///< s0-s31.
};
u32 fpscr; ///< fpscr.
Expand Down
2 changes: 1 addition & 1 deletion libctru/source/services/soc/soc_inet_pton.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

static int inet_pton4(const char *restrict src, void *restrict dst)
{
u8 ip[4] ALIGN(4);
u8 ip[4] __attribute__((aligned(4)));
if(sscanf(src,"%hhu.%hhu.%hhu.%hhu",&ip[0], &ip[1], &ip[2], &ip[3]) != 4) return 0;

memcpy(dst,ip,4);
Expand Down

0 comments on commit b9cb403

Please sign in to comment.