Skip to content

Commit

Permalink
gb: mark deprecated functions
Browse files Browse the repository at this point in the history
Signed-off-by: Mahyar Koshkouei <[email protected]>
  • Loading branch information
deltabeard committed Jan 17, 2025
1 parent 1fbf964 commit 57ca057
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/sdl2/peanut_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void gb_error(struct gb_s *gb, const enum gb_error_e gb_err, const uint16_t addr
"INVALID OPCODE",
"INVALID READ",
"INVALID WRITE",
"HALT FOREVER"
""
};
struct priv_t *priv = gb->direct.priv;
char error_msg[256];
Expand Down
21 changes: 16 additions & 5 deletions peanut_gb.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@

#define PEANUT_GB_ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))

/** Allow setting deprecated functions and variables. */
#if (defined(__GNUC__) && __GNUC__ >= 6) || (defined(__clang__) && __clang_major__ >= 4)
# define PGB_DEPRECATED(msg) __attribute__((deprecated(msg)))
#else
# define PGB_DEPRECATED(msg)
#endif

#if !defined(__has_builtin)
/* Stub __has_builtin if it isn't available. */
# define __has_builtin(x) 0
Expand Down Expand Up @@ -498,12 +505,15 @@ struct count_s
enum gb_error_e
{
GB_UNKNOWN_ERROR = 0,
GB_INVALID_OPCODE,
GB_INVALID_READ,
GB_INVALID_WRITE,
GB_HALT_FOREVER,
GB_INVALID_OPCODE = 1,
GB_INVALID_READ = 2,
GB_INVALID_WRITE = 3,

/* GB_HALT_FOREVER is deprecated and will no longer be issued as an
* error by Peanut-GB. */
GB_HALT_FOREVER PGB_DEPRECATED("Error no longer issued by Peanut-GB") = 4,

GB_INVALID_MAX
GB_INVALID_MAX = 5
};

/**
Expand Down Expand Up @@ -3728,6 +3738,7 @@ void gb_set_bootrom(struct gb_s *gb,
/**
* Deprecated. Will be removed in the next major version.
*/
PGB_DEPRECATED("RTC is now ticked internally; this function has no effect")
void gb_tick_rtc(struct gb_s *gb)
{
(void) gb;
Expand Down

0 comments on commit 57ca057

Please sign in to comment.