1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tie up standards macros loose ends (re: 289dd46c)

src/lib/libast/features/standards:
- Do not emit #defines for the typ u_long test which is only used
  as a heuristic in subsequent tests in this file. (Note that 'set'
  can set and unset any iffe command-line --option at runtime.)
- Remove definition of _ISOC99_SOURCE macro. This is another old
  GNU thing; feature_test_macros(7) says invoking the compiler with
  the option -std=c99 has the same effect. But modern GCC has C11
  with GNU extensions as the default, which is fine. If a
  particular standard is desired, pass a -std=... flag in $CC.

src/cmd/ksh93/features/rlimits:
- Remove overlooked Linux *64* types/functions hackery.
  After defining standards macros it caused a build failure
  on at least one version of Void Linux (but not 5.15.14_1).
  Thanks to @JohnoKing for the report.

src/cmd/ksh93/sh/subshell.c,
src/lib/libdll/dllnext.c:
- Remove now-redundant local definitions of _GNU_SOURCE and
  __EXTENSIONS__ macros.

src/cmd/ksh93/tests/builtins.sh:
- Fix broken sed invocation (re: 41829efa).
This commit is contained in:
Martijn Dekker 2022-01-20 04:20:17 +00:00
parent 41829efa06
commit 2c4b05b4f8
5 changed files with 12 additions and 49 deletions

View file

@ -1,25 +1,11 @@
hdr,sys resource,vlimit sys/time.h hdr,sys resource,vlimit sys/time.h
lib getrlimit,getrlimit64,ulimit,vlimit lib getrlimit,ulimit,vlimit
typ rlim_t,rlim64_t sys/types.h sys/time.h sys/resource.h typ rlim_t sys/types.h sys/time.h sys/resource.h
cat{ cat{
#if _sys_resource #if _sys_resource
# include <sys/resource.h> # include <sys/resource.h>
# if _lib_getrlimit64 && _typ_rlim64_t
# undef getrlimit
# define getrlimit getrlimit64
# undef setrlimit
# define setrlimit setrlimit64
# undef rlimit
# define rlimit rlimit64
# undef rlim_t
# define rlim_t rlim64_t
# ifdef RLIM64_INFINITY
# undef RLIM_INFINITY
# define RLIM_INFINITY RLIM64_INFINITY
# endif
# endif
#endif #endif
}end }end

View file

@ -2,7 +2,7 @@
* * * *
* This software is part of the ast package * * This software is part of the ast package *
* Copyright (c) 1982-2012 AT&T Intellectual Property * * Copyright (c) 1982-2012 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m * * Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the * * and is licensed under the *
* Eclipse Public License, Version 1.0 * * Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property * * by AT&T Intellectual Property *
@ -26,10 +26,6 @@
* *
*/ */
#ifdef __linux__
#define _GNU_SOURCE /* needed for O_PATH */
#endif
#include "defs.h" #include "defs.h"
#include <ls.h> #include <ls.h>
#include "io.h" #include "io.h"

View file

@ -2,7 +2,7 @@
# # # #
# This software is part of the ast package # # This software is part of the ast package #
# Copyright (c) 1982-2012 AT&T Intellectual Property # # Copyright (c) 1982-2012 AT&T Intellectual Property #
# Copyright (c) 2020-2021 Contributors to ksh 93u+m # # Copyright (c) 2020-2022 Contributors to ksh 93u+m #
# and is licensed under the # # and is licensed under the #
# Eclipse Public License, Version 1.0 # # Eclipse Public License, Version 1.0 #
# by AT&T Intellectual Property # # by AT&T Intellectual Property #
@ -31,7 +31,7 @@ if builtin getconf 2> /dev/null; then
# The -l option should convert all variable names to lowercase. # The -l option should convert all variable names to lowercase.
# https://github.com/att/ast/issues/1171 # https://github.com/att/ast/issues/1171
got=$(getconf -lq | LC_ALL=C sed -n '/[A-Z].*=/p') got=$(getconf -lq | LC_ALL=C sed -n -e 's/=.*//' -e '/[A-Z]/p')
[[ -n $got ]] && err_exit "'getconf -l' doesn't convert all variable names to lowercase" \ [[ -n $got ]] && err_exit "'getconf -l' doesn't convert all variable names to lowercase" \
"(got $(printf %q "$got"))" "(got $(printf %q "$got"))"

View file

@ -4,7 +4,10 @@ set stdio
# Flag systems that omit necessary definitions such as u_long # Flag systems that omit necessary definitions such as u_long
# when _POSIX_SOURCE or _XOPEN_SOURCE are defined. # when _POSIX_SOURCE or _XOPEN_SOURCE are defined.
# Affected: Mac OS X, UnixWare. # Affected: Mac OS X, UnixWare.
# Do not emit a #define for this test, just remember it for the next tests in this file.
set nodefine
typ u_long typ u_long
set define
# #
# The following tests try to define the features/standards macros that expose # The following tests try to define the features/standards macros that expose
@ -82,10 +85,9 @@ elif tst note{ Darwin (macOS, Mac OS X) }end compile{
elif tst note{ SunOS (Solaris, illumos) }end compile{ elif tst note{ SunOS (Solaris, illumos) }end compile{
/* /*
* On Solaris/illumos, we ignore the standards(5) manual completely because * On Solaris/illumos, we ignore the standards(5) manual completely because
* defining any standards macro, and even defining __EXTENSIONS__ (!), will * defining recommended standards macros will disable functionality that
* disable functionality that libast depends on. Instead we define unofficial * libast depends on. Instead we define unofficial _XPG* macros that enable
* _XPG* macros that enable up-to-date declarations and functionality in * up-to-date declarations and functionality in Solaris system headers.
* Solaris system headers.
* (Note that we must also avoid passing any -std=... flag to the compiler, * (Note that we must also avoid passing any -std=... flag to the compiler,
* because that will disable essential functionality as well.) * because that will disable essential functionality as well.)
*/ */
@ -333,17 +335,3 @@ else tst note{ __EXTENSIONS__ works }end compile{
#endif #endif
} }
endif endif
if tst -D_ISOC99_SOURCE -lm note{ _ISOC99_SOURCE plays nice }end link{
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
int main() { return signbit(-0.0); }
}end {
#ifndef _ISOC99_SOURCE
#define _ISOC99_SOURCE 1
#endif
}
endif

View file

@ -2,7 +2,7 @@
* * * *
* This software is part of the ast package * * This software is part of the ast package *
* Copyright (c) 1997-2011 AT&T Intellectual Property * * Copyright (c) 1997-2011 AT&T Intellectual Property *
* Copyright (c) 2020-2021 Contributors to ksh 93u+m * * Copyright (c) 2020-2022 Contributors to ksh 93u+m *
* and is licensed under the * * and is licensed under the *
* Eclipse Public License, Version 1.0 * * Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property * * by AT&T Intellectual Property *
@ -23,13 +23,6 @@
* AT&T Research * AT&T Research
*/ */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE 1
#endif
#ifndef __EXTENSIONS__
#define __EXTENSIONS__ 1
#endif
#include <ast.h> #include <ast.h>
#include <dlldefs.h> #include <dlldefs.h>