]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.h
sys: work around incomplete POSIX support in MacOS
[xonotic/darkplaces.git] / common.h
index 1414e633eb938a2a8ae436e0c7fe1c03492673ea..cde830dcfdc7e51fac232f75fee227459d8cfbcd 100644 (file)
--- a/common.h
+++ b/common.h
@@ -47,7 +47,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 typedef struct sizebuf_s
 {
-       qbool   allowoverflow;  ///< if false, do a Sys_Abort
+       qbool   allowoverflow;  ///< if false, do a Sys_Error
        qbool   overflowed;             ///< set to true if the buffer size failed
        unsigned char           *data;
        int                     maxsize;
@@ -221,7 +221,12 @@ void COM_Shutdown (void);
 char *va(char *buf, size_t buflen, const char *format, ...) DP_FUNC_PRINTF(3);
 // does a varargs printf into provided buffer, returns buffer (so it can be called in-line unlike dpsnprintf)
 
-// GCC with -Werror=c++-compat will error out if static_assert is used even though the macro is valid C11...
+/* Some versions of GCC with -Wc++-compat will complain if static_assert
+ * is used even though the macro is valid C11, so make it happy anyway
+ * because having build logs without any purple text is pretty satisfying.
+ * TODO: Disable the flag by default in makefile, with an optional variable
+ * to reenable it.
+ */
 #ifndef __cplusplus
 #define DP_STATIC_ASSERT(expr, str) _Static_assert(expr, str)
 #else
@@ -234,11 +239,14 @@ char *va(char *buf, size_t buflen, const char *format, ...) DP_FUNC_PRINTF(3);
 #undef vsnprintf
 #define vsnprintf DP_STATIC_ASSERT(0, "vsnprintf is forbidden for portability reasons. Use dpvsnprintf instead.")
 
-// dpsnprintf and dpvsnprintf
-// return the number of printed characters, excluding the final '\0'
-// or return -1 if the buffer isn't big enough to contain the entire string.
-// buffer is ALWAYS null-terminated
+// documentation duplicated deliberately for the benefit of IDEs that support https://www.doxygen.nl/manual/docblocks.html
+/// Returns the number of printed characters, excluding the final '\0'
+/// or returns -1 if the buffer isn't big enough to contain the entire string.
+/// Buffer is ALWAYS null-terminated.
 extern int dpsnprintf (char *buffer, size_t buffersize, const char *format, ...) DP_FUNC_PRINTF(3);
+/// Returns the number of printed characters, excluding the final '\0'
+/// or returns -1 if the buffer isn't big enough to contain the entire string.
+/// Buffer is ALWAYS null-terminated.
 extern int dpvsnprintf (char *buffer, size_t buffersize, const char *format, va_list args);
 
 // A bunch of functions are forbidden for security reasons (and also to please MSVS 2005, for some of them)