From nobody Fri Apr 12 19:39:51 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VGRjM68ydz5HxTp; Fri, 12 Apr 2024 19:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VGRjM5R8Zz4TKq; Fri, 12 Apr 2024 19:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712950791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c+boC9KsUZ0DmXUudiE/hxJ7T3gL0JhGBdFZzSsBxnA=; b=ogXWQFyeBdzQqB2Gj6nLPFBAmNSyKQpaOOo9/GK5v3q/e/uJs1mE5armC2dpFZtZrFkILE ICT/Q4SYCDnrGPrwpj3Qn8yP/AvFZpcX8MQ0/YbLj8k87h3VD+swdB2dM5iSw7hUN4satK KINuDD6fcPeOWZou2fI6ZruBOGwQ0Z2EeIqltnd4al6xW3ujXI+nUEXoh9Et7hE4etjRLu VqKhIqm60h2ZEj95dsckVxnHDT5WPWUeT2hMMoITDbZLChYbudTJ1BA2VA+TR69lASu0x0 J7pOZvU+VehJkhiZZeeDzG6UdG7+otkba5efsYhoih6+ThEfPQoEMqniU/1L8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712950791; a=rsa-sha256; cv=none; b=gi3Fn9YN6c2CSzMb8i2zQtSr6jmuZsGaHNZYz21tbYiY3c495psbc9AWMt9DYMuzg+rq7c wmhAoYr/EhrfBvL9bFH+hxeXVrP4F4VUao2Kb1+WuFHmdpbwtk9Xu22uCiDR/4+DyH+wQe LrxONryPrCaJM86g9PnGcHLPAxYnkjNfXRFh6b3p3HHcztU80MKFGcMPgGfjVrEEpBRxGz cxi26g+1I2incSKa4p1JVs84QJ1UYiFeEvDH+Vsi2xgwJYW7ySIqemkcsJ818ebQ9+XiWP BurVCI+3SYbhabnSEqmfF3aU8ZveTlHX+otBxAov9O/CZ/r5yjstRC6F6FJdHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712950791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=c+boC9KsUZ0DmXUudiE/hxJ7T3gL0JhGBdFZzSsBxnA=; b=PYHpdPZsH/yE+CdqeBpCrPT/HaHrmvyqdtX+POOBmhE1l5YUoWQ97zoBCnZKtOuSMO6XiQ ntm5shxBa9RY1k5hTCOzb07CvKP9DGOU0FOgkelLtMiLgFOISQqH/fFlKbIb5MiXJJR616 mskeGc+U6nn3UdcDdtQEiYegz/blArZb4bWBdTqUrmy/WCvn8anVSY00i+GfeVoXcX+wjW Tu59kBDot9/gc9difKhMlHK9vxWmqp0unjaH8XmxpZsUDY0gT3wNW7ff1wlbJLOgAPfM6R R6Ai9Ui7d5LEzsStMqkVUp1h/P36X0ZYgu0gtvgDdH++Bg4BpYXmtQFrbXvCkQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VGRjM4sLqz12Vd; Fri, 12 Apr 2024 19:39:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43CJdp9F013343; Fri, 12 Apr 2024 19:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43CJdptQ013340; Fri, 12 Apr 2024 19:39:51 GMT (envelope-from git) Date: Fri, 12 Apr 2024 19:39:51 GMT Message-Id: <202404121939.43CJdptQ013340@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 7c7299df76e2 - main - libc: Remove support for pre-C99 C standards List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c7299df76e2c4b43a2a52d0df66ee977bb6773b Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7c7299df76e2c4b43a2a52d0df66ee977bb6773b commit 7c7299df76e2c4b43a2a52d0df66ee977bb6773b Author: Minsoo Choo AuthorDate: 2024-04-12 19:05:09 +0000 Commit: John Baldwin CommitDate: 2024-04-12 19:05:09 +0000 libc: Remove support for pre-C99 C standards Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D43254 --- lib/libc/stdlib/div.c | 30 +----------------------------- lib/libc/stdlib/imaxdiv.c | 7 +------ lib/libc/stdlib/ldiv.c | 7 +------ lib/libc/stdlib/lldiv.c | 7 +------ 4 files changed, 4 insertions(+), 47 deletions(-) diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c index af6f95553435..351dca870553 100644 --- a/lib/libc/stdlib/div.c +++ b/lib/libc/stdlib/div.c @@ -41,34 +41,6 @@ div(int num, int denom) r.quot = num / denom; r.rem = num % denom; -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) - /* - * The ANSI standard says that |r.quot| <= |n/d|, where - * n/d is to be computed in infinite precision. In other - * words, we should always truncate the quotient towards - * 0, never -infinity. - * - * Machine division and remainer may work either way when - * one or both of n or d is negative. If only one is - * negative and r.quot has been truncated towards -inf, - * r.rem will have the same sign as denom and the opposite - * sign of num; if both are negative and r.quot has been - * truncated towards -inf, r.rem will be positive (will - * have the opposite sign of num). These are considered - * `wrong'. - * - * If both are num and denom are positive, r will always - * be positive. - * - * This all boils down to: - * if num >= 0, but r.rem < 0, we got the wrong answer. - * In that case, to get the right answer, add 1 to r.quot and - * subtract denom from r.rem. - */ - if (num >= 0 && r.rem < 0) { - r.quot++; - r.rem -= denom; - } -#endif + return (r); } diff --git a/lib/libc/stdlib/imaxdiv.c b/lib/libc/stdlib/imaxdiv.c index de72ead031d5..bf9737a3c47a 100644 --- a/lib/libc/stdlib/imaxdiv.c +++ b/lib/libc/stdlib/imaxdiv.c @@ -36,11 +36,6 @@ imaxdiv(intmax_t numer, intmax_t denom) retval.quot = numer / denom; retval.rem = numer % denom; -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) - if (numer >= 0 && retval.rem < 0) { - retval.quot++; - retval.rem -= denom; - } -#endif + return (retval); } diff --git a/lib/libc/stdlib/ldiv.c b/lib/libc/stdlib/ldiv.c index 999e8472042d..4c73bcc14af4 100644 --- a/lib/libc/stdlib/ldiv.c +++ b/lib/libc/stdlib/ldiv.c @@ -43,11 +43,6 @@ ldiv(long num, long denom) r.quot = num / denom; r.rem = num % denom; -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) - if (num >= 0 && r.rem < 0) { - r.quot++; - r.rem -= denom; - } -#endif + return (r); } diff --git a/lib/libc/stdlib/lldiv.c b/lib/libc/stdlib/lldiv.c index f7030e7ae1ff..6feeb74bacd6 100644 --- a/lib/libc/stdlib/lldiv.c +++ b/lib/libc/stdlib/lldiv.c @@ -36,11 +36,6 @@ lldiv(long long numer, long long denom) retval.quot = numer / denom; retval.rem = numer % denom; -#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) - if (numer >= 0 && retval.rem < 0) { - retval.quot++; - retval.rem -= denom; - } -#endif + return (retval); }