After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 670128 - G_STRFUNC does not work on Visual Studio platform (_MSC_VER defined)
G_STRFUNC does not work on Visual Studio platform (_MSC_VER defined)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Windows
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-02-15 10:39 UTC by Filippo Della Betta
Modified: 2012-02-24 21:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
G_STRFUNC for Visual Studio platform (836 bytes, patch)
2012-02-16 09:06 UTC, Filippo Della Betta
committed Details | Review

Description Filippo Della Betta 2012-02-15 10:39:34 UTC
When using glib in Visual Studio, G_STRFUNC is defined as (const char *)) "???" )
When _MSC_VER is defined G_STRFUNC could be defined as __FUNCTION__
According to MSDN (http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.71).aspx) __FUNCTION__ is defined since (at least) Microsoft Visual Studio .NET 2003
Comment 1 Allison Karlitskaya (desrt) 2012-02-15 10:40:34 UTC
A tested patch would very much be appreciated.

Thanks in advance.
Comment 2 Filippo Della Betta 2012-02-16 09:06:08 UTC
Created attachment 207736 [details] [review]
G_STRFUNC for Visual Studio platform
Comment 3 Colin Walters 2012-02-16 17:16:07 UTC
Review of attachment 207736 [details] [review]:

::: glib/gmacros.h
@@ +168,3 @@
 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
 #  define G_STRFUNC     ((const char*) (__func__))
+#elif defined(_MSC_VER) && (_MSC_VER > 1300)

Stupid question, but you said "since (at least) Microsoft Visual Studio .NET 2003" but here you're using >, not >=.  What's the _MSC_VER for .NET 2003?  Is it greater than 1300?
Comment 4 Filippo Della Betta 2012-02-16 17:33:03 UTC
Review of attachment 207736 [details] [review]:

::: glib/gmacros.h
@@ +168,3 @@
 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
 #  define G_STRFUNC     ((const char*) (__func__))
+#elif defined(_MSC_VER) && (_MSC_VER > 1300)

Visual Studio .NET 2003 has _MSC_VER == 1310
(http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx)
the previous version is MSVC++ 7.0 that has _MSC_VER == 1300.
If you prefer you can put _MSC_VER >= 1310, but it is the same
Comment 5 Colin Walters 2012-02-16 18:01:05 UTC
(In reply to comment #4)
>
> Visual Studio .NET 2003 has _MSC_VER == 1310
> (http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx)
> the previous version is MSVC++ 7.0 that has _MSC_VER == 1300.
> If you prefer you can put _MSC_VER >= 1310, but it is the same

Ok, just wanted to double check.  Patch looks fine, do you have commit access?
Comment 6 Filippo Della Betta 2012-02-16 21:08:53 UTC
Ok, fine.
No, I don't have commit access.
Comment 7 Allison Karlitskaya (desrt) 2012-02-24 21:22:24 UTC
Okay.  I've pushed the patch for you.

Thanks for the contribution!