On Mon, Sep 03, 2012 at 19:14, Gregor Pintar wrote:
> Hello.
> 
> I have a problem compiling my ANSI C (with GTK+) code on OpenBSD.
> It seems gtk.h includes unistd.h and conflicts with my encrypt() function,
> but as far as I know encrypt() shouldn't be defined unless
> _XOPEN_SOURCE is defined,
> which I don't define and I use -ansi parameter.

Currently, if you want ANSI, you have to define _ANSI_SOURCE yourself,
but I think we should maybe do that.

If the user said -ansi, let's assume they want _ANSI_SOURCE too.

Index: cdefs.h
===================================================================
RCS file: /cvs/src/sys/sys/cdefs.h,v
retrieving revision 1.34
diff -u -p -r1.34 cdefs.h
--- cdefs.h     14 Aug 2012 20:11:37 -0000      1.34
+++ cdefs.h     3 Sep 2012 17:56:06 -0000
@@ -361,6 +361,9 @@
  * If the user defines it in addition to one of the POSIX or XOPEN
  * macros, assume the POSIX/XOPEN macro(s) should take precedence.
  */
+#if __STRICT_ANSI__
+#define _ANSI_SOURCE
+#endif
 #if defined(_ANSI_SOURCE) && !defined(__POSIX_VISIBLE) && \
     !defined(__XPG_VISIBLE)
 # define __POSIX_VISIBLE       0

Reply via email to