Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
04a6fe6e
Commit
04a6fe6e
authored
May 17, 2023
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work around some bad code generation by Clang.
parent
ea205fb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
miniaudio.h
miniaudio.h
+18
-10
No files found.
miniaudio.h
View file @
04a6fe6e
...
@@ -3914,6 +3914,7 @@ typedef ma_uint16 wchar_t;
...
@@ -3914,6 +3914,7 @@ typedef ma_uint16 wchar_t;
#ifdef _MSC_VER
#ifdef _MSC_VER
#define MA_INLINE __forceinline
#define MA_INLINE __forceinline
#define MA_NO_INLINE __declspec(noinline)
#elif defined(__GNUC__)
#elif defined(__GNUC__)
/*
/*
I've had a bug report where GCC is emitting warnings about functions possibly not being inlineable. This warning happens when
I've had a bug report where GCC is emitting warnings about functions possibly not being inlineable. This warning happens when
...
@@ -3930,13 +3931,17 @@ typedef ma_uint16 wchar_t;
...
@@ -3930,13 +3931,17 @@ typedef ma_uint16 wchar_t;
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) || defined(__clang__)
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) || defined(__clang__)
#define MA_INLINE MA_GNUC_INLINE_HINT __attribute__((always_inline))
#define MA_INLINE MA_GNUC_INLINE_HINT __attribute__((always_inline))
#define MA_NO_INLINE __attribute__((noinline))
#else
#else
#define MA_INLINE MA_GNUC_INLINE_HINT
#define MA_INLINE MA_GNUC_INLINE_HINT
#define MA_NO_INLINE __attribute__((noinline))
#endif
#endif
#elif defined(__WATCOMC__)
#elif defined(__WATCOMC__)
#define MA_INLINE __inline
#define MA_INLINE __inline
#define MA_NO_INLINE
#else
#else
#define MA_INLINE
#define MA_INLINE
#define MA_NO_INLINE
#endif
#endif
#if !defined(MA_API)
#if !defined(MA_API)
...
@@ -12296,8 +12301,11 @@ Return Values:
...
@@ -12296,8 +12301,11 @@ Return Values:
34: ERANGE
34: ERANGE
Not using symbolic constants for errors because I want to avoid #including errno.h
Not using symbolic constants for errors because I want to avoid #including errno.h
These are marked as no-inline because of some bad code generation by Clang. None of these functions
are used in any performance-critical code within miniaudio.
*/
*/
MA_API int ma_strcpy_s(char* dst, size_t dstSizeInBytes, const char* src)
MA_API
MA_NO_INLINE
int ma_strcpy_s(char* dst, size_t dstSizeInBytes, const char* src)
{
{
size_t i;
size_t i;
...
@@ -12325,7 +12333,7 @@ MA_API int ma_strcpy_s(char* dst, size_t dstSizeInBytes, const char* src)
...
@@ -12325,7 +12333,7 @@ MA_API int ma_strcpy_s(char* dst, size_t dstSizeInBytes, const char* src)
return 34;
return 34;
}
}
MA_API int ma_wcscpy_s(wchar_t* dst, size_t dstCap, const wchar_t* src)
MA_API
MA_NO_INLINE
int ma_wcscpy_s(wchar_t* dst, size_t dstCap, const wchar_t* src)
{
{
size_t i;
size_t i;
...
@@ -12354,7 +12362,7 @@ MA_API int ma_wcscpy_s(wchar_t* dst, size_t dstCap, const wchar_t* src)
...
@@ -12354,7 +12362,7 @@ MA_API int ma_wcscpy_s(wchar_t* dst, size_t dstCap, const wchar_t* src)
}
}
MA_API int ma_strncpy_s(char* dst, size_t dstSizeInBytes, const char* src, size_t count)
MA_API
MA_NO_INLINE
int ma_strncpy_s(char* dst, size_t dstSizeInBytes, const char* src, size_t count)
{
{
size_t maxcount;
size_t maxcount;
size_t i;
size_t i;
...
@@ -12388,7 +12396,7 @@ MA_API int ma_strncpy_s(char* dst, size_t dstSizeInBytes, const char* src, size_
...
@@ -12388,7 +12396,7 @@ MA_API int ma_strncpy_s(char* dst, size_t dstSizeInBytes, const char* src, size_
return 34;
return 34;
}
}
MA_API int ma_strcat_s(char* dst, size_t dstSizeInBytes, const char* src)
MA_API
MA_NO_INLINE
int ma_strcat_s(char* dst, size_t dstSizeInBytes, const char* src)
{
{
char* dstorig;
char* dstorig;
...
@@ -12430,7 +12438,7 @@ MA_API int ma_strcat_s(char* dst, size_t dstSizeInBytes, const char* src)
...
@@ -12430,7 +12438,7 @@ MA_API int ma_strcat_s(char* dst, size_t dstSizeInBytes, const char* src)
return 0;
return 0;
}
}
MA_API int ma_strncat_s(char* dst, size_t dstSizeInBytes, const char* src, size_t count)
MA_API
MA_NO_INLINE
int ma_strncat_s(char* dst, size_t dstSizeInBytes, const char* src, size_t count)
{
{
char* dstorig;
char* dstorig;
...
@@ -12476,7 +12484,7 @@ MA_API int ma_strncat_s(char* dst, size_t dstSizeInBytes, const char* src, size_
...
@@ -12476,7 +12484,7 @@ MA_API int ma_strncat_s(char* dst, size_t dstSizeInBytes, const char* src, size_
return 0;
return 0;
}
}
MA_API int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, int radix)
MA_API
MA_NO_INLINE
int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, int radix)
{
{
int sign;
int sign;
unsigned int valueU;
unsigned int valueU;
...
@@ -12545,7 +12553,7 @@ MA_API int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, int radix)
...
@@ -12545,7 +12553,7 @@ MA_API int ma_itoa_s(int value, char* dst, size_t dstSizeInBytes, int radix)
return 0;
return 0;
}
}
MA_API int ma_strcmp(const char* str1, const char* str2)
MA_API
MA_NO_INLINE
int ma_strcmp(const char* str1, const char* str2)
{
{
if (str1 == str2) return 0;
if (str1 == str2) return 0;
...
@@ -12568,7 +12576,7 @@ MA_API int ma_strcmp(const char* str1, const char* str2)
...
@@ -12568,7 +12576,7 @@ MA_API int ma_strcmp(const char* str1, const char* str2)
return ((unsigned char*)str1)[0] - ((unsigned char*)str2)[0];
return ((unsigned char*)str1)[0] - ((unsigned char*)str2)[0];
}
}
MA_API int ma_strappend(char* dst, size_t dstSize, const char* srcA, const char* srcB)
MA_API
MA_NO_INLINE
int ma_strappend(char* dst, size_t dstSize, const char* srcA, const char* srcB)
{
{
int result;
int result;
...
@@ -12585,7 +12593,7 @@ MA_API int ma_strappend(char* dst, size_t dstSize, const char* srcA, const char*
...
@@ -12585,7 +12593,7 @@ MA_API int ma_strappend(char* dst, size_t dstSize, const char* srcA, const char*
return result;
return result;
}
}
MA_API char* ma_copy_string(const char* src, const ma_allocation_callbacks* pAllocationCallbacks)
MA_API
MA_NO_INLINE
char* ma_copy_string(const char* src, const ma_allocation_callbacks* pAllocationCallbacks)
{
{
size_t sz;
size_t sz;
char* dst;
char* dst;
...
@@ -12605,7 +12613,7 @@ MA_API char* ma_copy_string(const char* src, const ma_allocation_callbacks* pAll
...
@@ -12605,7 +12613,7 @@ MA_API char* ma_copy_string(const char* src, const ma_allocation_callbacks* pAll
return dst;
return dst;
}
}
MA_API wchar_t* ma_copy_string_w(const wchar_t* src, const ma_allocation_callbacks* pAllocationCallbacks)
MA_API
MA_NO_INLINE
wchar_t* ma_copy_string_w(const wchar_t* src, const ma_allocation_callbacks* pAllocationCallbacks)
{
{
size_t sz = wcslen(src)+1;
size_t sz = wcslen(src)+1;
wchar_t* dst = (wchar_t*)ma_malloc(sz * sizeof(*dst), pAllocationCallbacks);
wchar_t* dst = (wchar_t*)ma_malloc(sz * sizeof(*dst), pAllocationCallbacks);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment