Re: [Viking-devel] pkgsrc updated to 1.8, stray visibility defines fix

2020-03-18 Thread Greg Troxel
Robert Norris  writes:

>> #define _XOPEN_SOURCE
>
> Simply removing it is the best option, as it compiles and runs on Linux OK 
> without this line.
> I've no idea why it was put in, but the line originates from the initial code 
> creation back in 2005.
> Some background on this define:
>
> https://stackoverflow.com/questions/5378778/what-does-d-xopen-source-do-mean
>
> So as Viking doesn't use strdup() directly (it uses g_() versions when 
> available), any usage (or attempt thereof) of _XOPEN_SOURCE is unnecessary.
> Even in the very first version of gpx.c, strdup() was not used.
>  
> Admittedly I always wondered a little about this define really meant/what it 
> was used for, but never bothered to investigate further as it appeared to 
> 'work'.
>
> PS. Thanks as always for your pkgsrc efforts

2005 was a really long time ago.  So definitely just take it out, and if
something turns out to be needed on solaris, somebody can figure out the
minimal change.


The real point of these defines is to have a program declare the
specification it is written so, so that operating systems will hide all
symbols and functions etc. that are not mandated by that standard.  This
checks that the program really is portable.

Instead, they often get used when some operating system does not make
available extensions by default.  However, more or less the norm today
is that if POSIX specifies it, and the OS doesn't provide it, the OS
should be fixed (and usually is).


___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


Re: [Viking-devel] pkgsrc updated to 1.8, stray visibility defines fix

2020-03-17 Thread Robert Norris


> #define _XOPEN_SOURCE

Simply removing it is the best option, as it compiles and runs on Linux OK 
without this line.
I've no idea why it was put in, but the line originates from the initial code 
creation back in 2005.
Some background on this define:

https://stackoverflow.com/questions/5378778/what-does-d-xopen-source-do-mean

So as Viking doesn't use strdup() directly (it uses g_() versions when 
available), any usage (or attempt thereof) of _XOPEN_SOURCE is unnecessary.
Even in the very first version of gpx.c, strdup() was not used.
 
Admittedly I always wondered a little about this define really meant/what it 
was used for, but never bothered to investigate further as it appeared to 
'work'.

PS. Thanks as always for your pkgsrc efforts

___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/


[Viking-devel] pkgsrc updated to 1.8, stray visibility defines fix

2020-03-17 Thread Greg Troxel
I have updated pkgsrc to 1.8.  I haven't really shaken it out, but it
starts up fine on NetBSD 8 amd64.

I have a stray patch from before.  I am not sure what's going on with
the original visibility define, and why it needs to be different on
sunos.

In general, I lean to not having any visibility defines unless
they are really necessary and then only guarded with ifdefs for where
needed, as once you add one other symbols are hidden.

Also, I typically find that they are added and then not removed, so I
wonder if just removing _XOPEN_SOURCE line results in an ok build on
modern linux.  If not, I would be nice to a) ifdef guard it for linux
and version, and 2) explain what the failure is.

I built on NetBSD 8 w/o any of this (both _XOPEN_SOURCE lines and all
the ifs just plain removed) and it built fine.

It may be that on sunos, not defining _XOPEN_SOURCE is ok, but defining
it without a value is bad.

Thanks,
Greg




$NetBSD: patch-src_gpx.c,v 1.3 2020/03/18 00:02:46 gdt Exp $

This is a build fix for SunOS.
\todo Explain why, and if the new __sun way is correct in general.
\todo File upstream.

--- src/gpx.c.orig  2020-01-30 08:34:43.0 +
+++ src/gpx.c
@@ -26,7 +26,12 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+
+#if defined(__sun)
+#define _XOPEN_SOURCE 600
+#else
 #define _XOPEN_SOURCE /* glibc2 needs this */
+#endif
 
 #include "gpx.h"
 #include "viking.h"


___
Viking-devel mailing list
Viking-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viking-devel
Viking home page: http://viking.sf.net/