summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-08-28 10:38:06 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-08-28 10:38:06 +0000
commit3c2c418ed925503520d69d3b17650956b2324143 (patch)
treeb0c178493ed8b96684e2fb2145f262192b61d571
parentb0a49d3a16d43739c1e01147f1ee10810f46ba3e (diff)
downloadmandoc-3c2c418ed925503520d69d3b17650956b2324143.tar.gz
On Linux, wcwidth() needs _XOPEN_SOURCE, or just _GNU_SOURCE for simplicity.
Besides, signedness of wchar_t and wint_t may differ, it i only guaranteed that each wchar_t can be represented as a wint_t. A problem report by Daniel Levai reminded me to fix this.
-rwxr-xr-xconfigure2
-rw-r--r--test-wchar.c6
2 files changed, 6 insertions, 2 deletions
diff --git a/configure b/configure
index baa05ad4..0fb841cf 100755
--- a/configure
+++ b/configure
@@ -253,7 +253,7 @@ cat << __HEREDOC__
#define MANDOC_CONFIG_H
#if defined(__linux__) || defined(__MINT__)
-#define _GNU_SOURCE /* getsubopt(), strcasestr(), strptime() */
+#define _GNU_SOURCE /* See test-*.c what needs this. */
#endif
__HEREDOC__
diff --git a/test-wchar.c b/test-wchar.c
index 0dc85ea4..72f4844e 100644
--- a/test-wchar.c
+++ b/test-wchar.c
@@ -15,6 +15,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#if defined(__linux__) || defined(__MINT__)
+#define _GNU_SOURCE /* wcwidth() */
+#endif
+
#include <locale.h>
#include <stdio.h>
#include <wchar.h>
@@ -50,7 +54,7 @@ main(void)
dup2(STDERR_FILENO, STDOUT_FILENO);
wc = L'*';
- if (putwchar(wc) != wc) {
+ if (putwchar(wc) != (wint_t)wc) {
fputs("bad putwchar return value\n", stderr);
return(1);
}