comparison dw.h @ 2159:48172881415c

GTK: Add DW_UNUSED() macro for defining variables that may be unused. Move the compiler macro section to the top of dw.h for use all over. Use DW_UNUSED() to avoid several expected warnings in the GTK code.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 29 Sep 2020 04:06:20 +0000
parents 709f8bfa711f
children 98db0e81a514
comparison
equal deleted inserted replaced
2158:df3ee6273557 2159:48172881415c
11 #define DW_MAJOR_VERSION 3 11 #define DW_MAJOR_VERSION 3
12 #define DW_MINOR_VERSION 1 12 #define DW_MINOR_VERSION 1
13 #define DW_SUB_VERSION 0 13 #define DW_SUB_VERSION 0
14 14
15 #define DW_HOME_URL "http://dwindows.netlabs.org" 15 #define DW_HOME_URL "http://dwindows.netlabs.org"
16
17 /* Support for API deprecation in supported compilers */
18 #if defined(__has_feature) && !defined(__has_extension)
19 #define __has_extension __has_feature
20 #endif
21
22 /* Visual C */
23 #if defined(_MSC_VER)
24 # if _MSC_VER >= 1400
25 # define DW_DEPRECATED(func, message) __declspec(deprecated(message)) func
26 # endif
27 /* Clang */
28 #elif defined(__clang__) && defined(__has_extension)
29 # if __has_extension(attribute_deprecated_with_message)
30 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message)))
31 # else
32 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated))
33 # endif
34 /* GCC */
35 #elif defined(__GNUC__)
36 # if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40500
37 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message)))
38 # else
39 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated))
40 # endif
41 #endif
42
43 /* Compiler without deprecation support */
44 #ifndef DW_DEPRECATED
45 #define DW_DEPRECATED(func, message) func
46 #endif
47
48 /* Support for unused variables in supported compilers */
49 #if defined(__GNUC__) || (defined(__clang__) && defined(__has_extension))
50 #define DW_UNUSED(x) x __attribute__((__unused__))
51 #else
52 #define DW_UNUSED(x) x
53 #endif
16 54
17 #if !defined(__PHOTON__) 55 #if !defined(__PHOTON__)
18 /* These corespond to the entries in the color 56 /* These corespond to the entries in the color
19 * arrays in the Win32 dw.c, they are also the 57 * arrays in the Win32 dw.c, they are also the
20 * same as DOS ANSI colors. 58 * same as DOS ANSI colors.
1300 long resource_max, *resource_id; 1338 long resource_max, *resource_id;
1301 char **resource_data; 1339 char **resource_data;
1302 } DWResources; 1340 } DWResources;
1303 1341
1304 #if !defined(DW_RESOURCES) || defined(BUILD_DLL) 1342 #if !defined(DW_RESOURCES) || defined(BUILD_DLL)
1305 static DWResources _resources = { 0, 0, 0 }; 1343 static DWResources DW_UNUSED(_resources) = { 0, 0, 0 };
1306 #else 1344 #else
1307 extern DWResources _resources; 1345 extern DWResources _resources;
1308 #endif 1346 #endif
1309 1347
1310 #endif 1348 #endif
1572 #define UINT_TYPEDEFED 1 1610 #define UINT_TYPEDEFED 1
1573 #define INT_TYPEDEFED 1 1611 #define INT_TYPEDEFED 1
1574 1612
1575 /* Use the dbsoft.org application domain by default if not specified */ 1613 /* Use the dbsoft.org application domain by default if not specified */
1576 #define DW_APP_DOMAIN_DEFAULT "org.dbsoft.dwindows" 1614 #define DW_APP_DOMAIN_DEFAULT "org.dbsoft.dwindows"
1577
1578 /* Support for API deprecation in supported compilers */
1579 #if defined(__has_feature) && !defined(__has_extension)
1580 #define __has_extension __has_feature
1581 #endif
1582
1583 /* Visual C */
1584 #if defined(_MSC_VER)
1585 # if _MSC_VER >= 1400
1586 # define DW_DEPRECATED(func, message) __declspec(deprecated(message)) func
1587 # endif
1588 /* Clang */
1589 #elif defined(__has_extension)
1590 # if __has_extension(attribute_deprecated_with_message)
1591 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message)))
1592 # else
1593 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated))
1594 # endif
1595 /* GCC */
1596 #elif defined(__GNUC__)
1597 # if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) >= 40500
1598 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated (message)))
1599 # else
1600 # define DW_DEPRECATED(func, message) func __attribute__ ((deprecated))
1601 # endif
1602 #endif
1603
1604 /* Compiler without deprecation support */
1605 #ifndef DW_DEPRECATED
1606 #define DW_DEPRECATED(func, message) func
1607 #endif
1608 1615
1609 /* Public function prototypes */ 1616 /* Public function prototypes */
1610 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad); 1617 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
1611 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad); 1618 void API dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
1612 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad); 1619 void API dw_box_pack_at_index(HWND box, HWND item, int index, int width, int height, int hsize, int vsize, int pad);