[glib: 1/2] gmacros: MSVC supports the noreturn function attribute



commit 2a76dba03e7a421cd86ef348eae58723c49c3cdc
Author: Nirbheek Chauhan <nirbheek centricular com>
Date:   Tue Jan 15 01:35:35 2019 +0530

    gmacros: MSVC supports the noreturn function attribute
    
    But it can't be used as a drop-in implementation of G_GNUC_NORETURN
    because it can only be placed at the start of the function prototype.
    
    Document this in a comment so that the next person doesn't spend
    20 min figuring it out.

 glib/gmacros.h | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 2f3d84746..1fe6e760c 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -190,6 +190,10 @@
 #define G_GNUC_SCANF( format_idx, arg_idx )
 #define G_GNUC_STRFTIME( format_idx )
 #define G_GNUC_FORMAT( arg_idx )
+/* NOTE: MSVC has __declspec(noreturn) but unlike GCC __attribute__,
+ * __declspec can only be placed at the start of the function prototype
+ * and not at the end, so we can't use it without breaking API.
+ */
 #define G_GNUC_NORETURN
 #define G_GNUC_CONST
 #define G_GNUC_UNUSED


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]