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 704543 - Add implementations for G_GNUC_*_IGNORE_DEPRECATIONS for Visual C++
Add implementations for G_GNUC_*_IGNORE_DEPRECATIONS for Visual C++
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.37.x
Other Windows
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-07-19 11:20 UTC by Fan, Chun-wei
Modified: 2013-07-29 02:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use __pragma to implement G_GNUC_*_IGNORE_DEPRECATIONS for MSVC 2008 and later (1.25 KB, patch)
2013-07-19 11:20 UTC, Fan, Chun-wei
committed Details | Review

Description Fan, Chun-wei 2013-07-19 11:20:52 UTC
Created attachment 249617 [details] [review]
Use __pragma to implement G_GNUC_*_IGNORE_DEPRECATIONS for MSVC 2008 and later

Hi,

When I was trying to compile GTK+, I was coming across the use of G_GNUC_BEGIN_IGNORE_DEPRECATIONS and G_GNUC_END_IGNORE_DEPRECATIONS as I was trying to get gtkrecentchooser.c (GTK+ 3.9.8+) to compile under Visual C++.  

Visual Studio 2008 and later provide the __pragma keyword that would allow one to specify compiler pragma options via the use of macros (in lieu of #pragma which is disallowed in macros), and one would be able to turn off warning C4996 (that is the Visual C++ warning for use of deprecated functions) for certain blocks of code by using such pragmas.

It might be so that G_GNUC_BEGIN_IGNORE_DEPRECATIONS/G_GNUC_END_IGNORE_DEPRECATIONS may not be the best name for these macros (as this is not GCC), but seem to fit in the picture.

I'm attaching my patch for this enhancement here, for references.

With blessings, thank you!
Comment 1 Matthias Clasen 2013-07-28 20:54:36 UTC
Review of attachment 249617 [details] [review]:

looks good to me, assuming you've tested it
Comment 2 Fan, Chun-wei 2013-07-29 02:41:56 UTC
Review of attachment 249617 [details] [review]:

Hi Matthias,

I have committed and pushed the patch as d0b4f59e on the master branch.

Thanks for the review, with blessings.