mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
Use modern C++ attributes instead of __attribute__ voodoo.
This is quite nice, although I wish [[gnu::always_inline]] implied inline. Also "gnu::" is kind of a wart, but whatcha gonna do.
This commit is contained in:
parent
fbcc8ab840
commit
022f7790db
Notes:
sideshowbarker
2024-07-19 15:42:33 +09:00
Author: https://github.com/awesomekling
Commit: 022f7790db
34 changed files with 99 additions and 124 deletions
|
@ -2,7 +2,7 @@ typedef unsigned char byte;
|
|||
typedef unsigned short word;
|
||||
typedef unsigned int dword;
|
||||
|
||||
ALWAYS_INLINE size_t strlen(const char* str)
|
||||
[[gnu::always_inline]] inline size_t strlen(const char* str)
|
||||
{
|
||||
size_t len = 0;
|
||||
while (*(str++))
|
||||
|
@ -13,7 +13,7 @@ ALWAYS_INLINE size_t strlen(const char* str)
|
|||
static constexpr const char* h = "0123456789abcdef";
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int print_hex(PutChFunc putch, char*& bufptr, dword number, byte fields)
|
||||
[[gnu::always_inline]] int print_hex(PutChFunc putch, char*& bufptr, dword number, byte fields)
|
||||
{
|
||||
int ret = 0;
|
||||
byte shr_count = fields * 4;
|
||||
|
@ -26,7 +26,7 @@ ALWAYS_INLINE int print_hex(PutChFunc putch, char*& bufptr, dword number, byte f
|
|||
}
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int print_number(PutChFunc putch, char*& bufptr, dword number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
[[gnu::always_inline]] int print_number(PutChFunc putch, char*& bufptr, dword number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
{
|
||||
dword divisor = 1000000000;
|
||||
char ch;
|
||||
|
@ -67,7 +67,7 @@ ALWAYS_INLINE int print_number(PutChFunc putch, char*& bufptr, dword number, boo
|
|||
}
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int print_octal_number(PutChFunc putch, char*& bufptr, dword number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
[[gnu::always_inline]] int print_octal_number(PutChFunc putch, char*& bufptr, dword number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
{
|
||||
dword divisor = 134217728;
|
||||
char ch;
|
||||
|
@ -108,7 +108,7 @@ ALWAYS_INLINE int print_octal_number(PutChFunc putch, char*& bufptr, dword numbe
|
|||
}
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int print_string(PutChFunc putch, char*& bufptr, const char* str, bool leftPad, dword fieldWidth)
|
||||
[[gnu::always_inline]] int print_string(PutChFunc putch, char*& bufptr, const char* str, bool leftPad, dword fieldWidth)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
if (!fieldWidth || fieldWidth < len)
|
||||
|
@ -129,7 +129,7 @@ ALWAYS_INLINE int print_string(PutChFunc putch, char*& bufptr, const char* str,
|
|||
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int print_signed_number(PutChFunc putch, char*& bufptr, int number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
[[gnu::always_inline]] int print_signed_number(PutChFunc putch, char*& bufptr, int number, bool leftPad, bool zeroPad, dword fieldWidth)
|
||||
{
|
||||
if (number < 0) {
|
||||
putch(bufptr, '-');
|
||||
|
@ -139,7 +139,7 @@ ALWAYS_INLINE int print_signed_number(PutChFunc putch, char*& bufptr, int number
|
|||
}
|
||||
|
||||
template<typename PutChFunc>
|
||||
ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fmt, char*& ap)
|
||||
[[gnu::always_inline]] int printf_internal(PutChFunc putch, char* buffer, const char*& fmt, char*& ap)
|
||||
{
|
||||
const char *p;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue