Anonymous avatar Anonymous committed 01a8efa

Fixed pragma usage for VC++.

Comments (0)

Files changed (5)

doc/capi/base.rst

 In addition to the types, a set of helpful macros was established, which are
 used heavily and should be relied on wherever possible.
 
+.. cfunction:: PRAGMA(q)
+
+  #pragma handler for usage within C macros. ::
+
+    PRAGMA(some simple pragma)
+
+  will be expanded depending on the compiler to something like ::
+
+    __pragma(some simple pragma) /* Visual C++ */
+    _Pragma("some simple pragma") /* GCC */
+
+  which in turn will be expanded to the default #pragma directive for
+  the compiler.
+
 .. cfunction:: MIN(q,v)
 
   Gets the smaller of two values. The own implementation will only be used,

src/base/pgdefines.h

 #include <limits.h>
 #include "pgtypes.h"
 
+#if defined(IS_WIN32) && defined(WIN32)
+#define PRAGMA(x) __pragma(x)
+#elif defined (__GNUC__)
+#define PRAGMA(x) _Pragma(#x)
+#else
+#define PRAGMA(x)
+#endif
+
 #ifndef MIN
 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
 #endif

src/sdl/surface_blit_rgb.c

                                                                         \
         if (srcbpp == 4 && dstbpp == 4)                                 \
         {                                                               \
-            _Pragma("omp parallel")                                     \
+            PRAGMA(omp parallel)                                        \
             {                                                           \
-                _Pragma("omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                 for (y = 0; y < height; y++)                            \
                 {                                                       \
                     for (x = 0; x < width; x++)                         \
         {                                                               \
             if (dstbpp == 1)                                            \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
             }                                                           \
             else /* dstbpp > 1 */                                       \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
         {                                                               \
             if (dstbpp == 1)                                            \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
             }                                                           \
             else /* dstbpp > 1 */                                       \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \

src/sdl/surface_blit_rgba.c

                                                                         \
         if (srcbpp == 4 && dstbpp == 4)                                 \
         {                                                               \
-            _Pragma("omp parallel")                                     \
+            PRAGMA(omp parallel)                                        \
             {                                                           \
-                _Pragma("omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                 for (y = 0; y < height; y++)                            \
                 {                                                       \
                     for (x = 0; x < width; x++)                         \
         {                                                               \
             if (dstbpp == 1)                                            \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
             }                                                           \
             else /* dstbpp > 1 */                                       \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
         {                                                               \
             if (dstbpp == 1)                                            \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \
             }                                                           \
             else /* dstbpp > 1 */                                       \
             {                                                           \
-                _Pragma("omp parallel")                                 \
+                PRAGMA(omp parallel)                                    \
                 {                                                       \
-                    _Pragma("omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)") \
+                    PRAGMA(omp for private(sppx,dppx,pixel,x,sR,sG,sB,sA,dR,dG,dB,dA,tmp,tmp2)) \
                     for (y = 0; y < height; y++)                        \
                     {                                                   \
                         for (x = 0; x < width; x++)                     \

src/sdl/surface_fill.c

         {                                                               \
             int x, y;                                                   \
             SDL_GetRGBA (color, fmt, &cR, &cG, &cB, &cA);               \
-            _Pragma("omp parallel")                                     \
+            PRAGMA(omp parallel)                                        \
             {                                                           \
-                _Pragma("omp for private(ppx,x,sR,sG,sB,sA,tmp)")       \
+                PRAGMA(omp for private(ppx,x,sR,sG,sB,sA,tmp))          \
                 for (y = 0; y < height; y++)                            \
                 {                                                       \
                     for (x = 0; x < width; x++)                         \
         {                                                               \
             int x, y;                                                   \
             GET_RGB_VALS (color, fmt, cR, cG, cB, cA);                  \
-            _Pragma("omp parallel")                                     \
+            PRAGMA(omp parallel)                                        \
             {                                                           \
-                _Pragma("omp for private(ppx,pixel,x,sR,sG,sB,sA,tmp)") \
+                PRAGMA(omp for private(ppx,pixel,x,sR,sG,sB,sA,tmp))    \
                 for (y = 0; y < height; y++)                            \
                 {                                                       \
                     for (x = 0; x < width; x++)                         \
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.