Hi, this patch adds some fixes in fixincludes specific to VMS. Until now we were using a manually modified subset of the VMS headers, but using fix includes is the right way.
Ok for mainline ? Tristan. fixincludes/ 2011-09-22 Tristan Gingold <ging...@adacore.com> * inclhack.def (ms_define_can_use_extern_prefix): (vms_use_pragma_extern_model, vms_disable_decc_string_builtins): New fixes. * fixincl.x: Regenerate. * tests/base/rtldef/string.h: New test. * tests/base/rtldef/decc$types.h: Likewise. * tests/base/testing.h: Update Index: inclhack.def =================================================================== --- inclhack.def (revision 179086) +++ inclhack.def (working copy) @@ -4508,6 +4508,65 @@ /* + * Define __CAN_USE_EXTERN_PREFIX on vms. + */ +fix = { + hackname = vms_define_can_use_extern_prefix; + files = "rtldef/decc$types.h"; + select = "#[ \t]*else\n" + "#[ \t]*if defined\\(__DECCXX\\)\n" + "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n"; + mach = "*-*-*vms*"; + c_fix = format; + + c_fix_arg = "%0" + "# elif defined (__GNUC__)\n" + "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"; + + test_text = "# else\n" + "# if defined(__DECCXX)\n" + "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n" + "# endif\n" + "# endif\n"; +}; + +/* + * On VMS, use pragma extern_model instead of VAX-C keywords. + */ +fix = { + hackname = vms_use_pragma_extern_model; + select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n" + "# pragma extern_model __save\n"; + mach = "*-*-*vms*"; + c_fix = format; + + c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n" + "# pragma extern_model __save\n"; + + test_text = "#if defined(__DECC) || defined(__DECCXX)\n" + "# pragma extern_model __save\n" + "# pragma extern_model strict_refdef\n" + " extern struct x zz$yy;\n" + "# pragma extern_model __restore\n" + "#endif\n"; +}; + +/* + * On VMS, disable the use of dec-c string builtins + */ +fix = { + hackname = vms_disable_decc_string_builtins; + select = "#if !defined\\(__VAX\\)\n"; + mach = "*-*-*vms*"; + files = "rtldef/string.h"; + c_fix = format; + + c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n"; + + test_text = "#if !defined(__VAX)\n"; +}; + +/* * AIX and Interix headers define NULL to be cast to a void pointer, * which is illegal in ANSI C++. */ Index: tests/base/rtldef/string.h =================================================================== --- tests/base/rtldef/string.h (revision 0) +++ tests/base/rtldef/string.h (revision 0) @@ -0,0 +1,15 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/rtldef/string.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( VMS_DISABLE_DECC_STRING_BUILTINS_CHECK ) +#if !defined(__VAX) && !defined(__GNUC__) + +#endif /* VMS_DISABLE_DECC_STRING_BUILTINS_CHECK */ Index: tests/base/rtldef/decc$types.h =================================================================== --- tests/base/rtldef/decc$types.h (revision 0) +++ tests/base/rtldef/decc$types.h (revision 0) @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE. + + It has been auto-edited by fixincludes from: + + "fixinc/tests/inc/rtldef/decc$types.h" + + This had to be done to correct non-standard usages in the + original, manufacturer supplied header file. */ + + + +#if defined( VMS_DEFINE_CAN_USE_EXTERN_PREFIX_CHECK ) +# else +# if defined(__DECCXX) +# define __CAN_USE_EXTERN_PREFIX 1 +# elif defined (__GNUC__) +# define __CAN_USE_EXTERN_PREFIX 1 +# endif +# endif + +#endif /* VMS_DEFINE_CAN_USE_EXTERN_PREFIX_CHECK */ Index: tests/base/testing.h =================================================================== --- tests/base/testing.h (revision 179086) +++ tests/base/testing.h (working copy) @@ -120,3 +120,14 @@ extern size_t strlen(), strspn(); #endif /* SYSV68_STRING_CHECK */ + + +#if defined( VMS_USE_PRAGMA_EXTERN_MODEL_CHECK ) +#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__) +# pragma extern_model __save +# pragma extern_model strict_refdef + extern struct x zz; +# pragma extern_model __restore +#endif + +#endif /* VMS_USE_PRAGMA_EXTERN_MODEL_CHECK */