[cfarm-users] AIX portability

Kaz Kylheku kaz at kylheku.com
Wed Sep 21 19:49:33 CEST 2022


On 2022-09-21 01:32, Bruno Haible wrote:
> Kaz Kylheku wrote:
>> gcc -E - -D_XOPEN_SOURCE=500
> 
> Defining _XOPEN_SOURCE — or worse, _POSIX_SOURCE — on arbitrary platforms
> is a recipe for producing compilation errors.
> 
> On HP-UX/hppa, -D_XOPEN_SOURCE=500 is useful.
> On HP-UX/ia64, -D_XOPEN_SOURCE=600 is useful, but only in combination with
> -D_HPUX_SOURCE.
> On Solaris 11, -D_XOPEN_SOURCE=700 is useful.

I'm actually using 700; the problem reproduced with that value too, then
I searched for the smallest value which still reproduces the problem.

The 2018 edition of POSIX defines _XOPEN_SOURCE as the way to reveal XSI material:

  The _XOPEN_SOURCE Feature Test Macro

  [XSI] [Option Start] An XSI-conforming application shall ensure that
  the feature test macro _XOPEN_SOURCE is defined with the value 700
  before inclusion of any header. This is needed to enable the functionality
  described in The _POSIX_C_SOURCE Feature Test Macro and to ensure that
  the XSI option is enabled.

So this is a standard thing everyone must implement; the application could
never be wrong if it defines this.

I'm aware of platforms where it fails to reveal definitions.

But revealing broken definitions is something else.


More information about the cfarm-users mailing list