Author: se
Date: Thu Oct  1 15:45:07 2020
New Revision: 366318
URL: https://svnweb.freebsd.org/changeset/base/366318

Log:
  Upgrade to version 3.1.6
  
  This upgrade addresses one (benign) compiler warning when building with
  LLVM-12.

Modified:
  head/contrib/bc/Makefile.in
  head/contrib/bc/NEWS.md
  head/contrib/bc/include/bc.h
  head/contrib/bc/release.sh
  head/contrib/bc/src/data.c
  head/contrib/bc/src/num.c
  head/contrib/bc/src/program.c
Directory Properties:
  head/contrib/bc/   (props changed)

Modified: head/contrib/bc/Makefile.in
==============================================================================
--- head/contrib/bc/Makefile.in Thu Oct  1 15:41:32 2020        (r366317)
+++ head/contrib/bc/Makefile.in Thu Oct  1 15:45:07 2020        (r366318)
@@ -29,7 +29,7 @@
 #
 .POSIX:
 
-VERSION = 3.1.5
+VERSION = 3.1.6
 
 SRC = %%SRC%%
 OBJ = %%OBJ%%

Modified: head/contrib/bc/NEWS.md
==============================================================================
--- head/contrib/bc/NEWS.md     Thu Oct  1 15:41:32 2020        (r366317)
+++ head/contrib/bc/NEWS.md     Thu Oct  1 15:45:07 2020        (r366318)
@@ -1,5 +1,13 @@
 # News
 
+## 3.1.6
+
+This is a production release that fixes a new warning from Clang 12 for FreeBSD
+and also removes some possible undefined behavior found by UBSan that compilers
+did not seem to take advantage of.
+
+Users do ***NOT*** need to upgrade, if they do not want to.
+
 ## 3.1.5
 
 This is a production release that fixes the Chinese locales (which caused `bc`

Modified: head/contrib/bc/include/bc.h
==============================================================================
--- head/contrib/bc/include/bc.h        Thu Oct  1 15:41:32 2020        
(r366317)
+++ head/contrib/bc/include/bc.h        Thu Oct  1 15:45:07 2020        
(r366318)
@@ -173,6 +173,10 @@ extern const BcParseNext bc_parse_next_elem;
 extern const BcParseNext bc_parse_next_for;
 extern const BcParseNext bc_parse_next_read;
 
+#else // BC_ENABLED
+
+#define BC_PARSE_NO_EXEC(p) (0)
+
 #endif // BC_ENABLED
 
 #endif // BC_BC_H

Modified: head/contrib/bc/release.sh
==============================================================================
--- head/contrib/bc/release.sh  Thu Oct  1 15:41:32 2020        (r366317)
+++ head/contrib/bc/release.sh  Thu Oct  1 15:45:07 2020        (r366318)
@@ -383,6 +383,7 @@ build_set() {
 clang_flags="-Weverything -Wno-padded -Wno-switch-enum -Wno-format-nonliteral"
 clang_flags="$clang_flags -Wno-cast-align -Wno-missing-noreturn 
-Wno-disabled-macro-expansion"
 clang_flags="$clang_flags -Wno-unreachable-code -Wno-unreachable-code-return"
+clang_flags="$clang_flags -Wno-implicit-fallthrough"
 gcc_flags="-Wno-maybe-uninitialized -Wno-clobbered"
 
 cflags="-Wall -Wextra -Werror -pedantic -Wno-conditional-uninitialized"

Modified: head/contrib/bc/src/data.c
==============================================================================
--- head/contrib/bc/src/data.c  Thu Oct  1 15:41:32 2020        (r366317)
+++ head/contrib/bc/src/data.c  Thu Oct  1 15:45:07 2020        (r366318)
@@ -141,8 +141,8 @@ const char* const bc_err_msgs[] = {
        "empty expression",
        "bad print statement",
        "bad function definition",
-       "bad assignment: left side must be scale, ibase, "
-               "obase, seed, last, var, or array element",
+       ("bad assignment: left side must be scale, ibase, "
+               "obase, seed, last, var, or array element"),
        "no auto variable found",
        "function parameter or auto \"%s%s\" already exists",
        "block end cannot be found",

Modified: head/contrib/bc/src/num.c
==============================================================================
--- head/contrib/bc/src/num.c   Thu Oct  1 15:41:32 2020        (r366317)
+++ head/contrib/bc/src/num.c   Thu Oct  1 15:45:07 2020        (r366318)
@@ -1457,7 +1457,8 @@ static void bc_num_parseDecimal(BcNum *restrict n, con
 
        for (i = 0; i < len && (zero = (val[i] == '0' || val[i] == '.')); ++i);
 
-       n->scale = (size_t) (rdx * ((val + len) - (ptr + 1)));
+       n->scale = (size_t) (rdx * (((uintptr_t) (val + len)) -
+                                   (((uintptr_t) ptr) + 1)));
        n->rdx = BC_NUM_RDX(n->scale);
 
        i = len - (ptr == val ? 0 : i) - rdx;
@@ -1656,7 +1657,7 @@ static void bc_num_printDecimal(const BcNum *restrict 
                memset(buffer, 0, BC_BASE_DIGS * sizeof(size_t));
 
                for (j = 0; n9 && j < BC_BASE_DIGS; ++j) {
-                       buffer[j] = n9 % BC_BASE;
+                       buffer[j] = ((size_t) n9) % BC_BASE;
                        n9 /= BC_BASE;
                }
 

Modified: head/contrib/bc/src/program.c
==============================================================================
--- head/contrib/bc/src/program.c       Thu Oct  1 15:41:32 2020        
(r366317)
+++ head/contrib/bc/src/program.c       Thu Oct  1 15:45:07 2020        
(r366318)
@@ -180,7 +180,7 @@ static inline BcVec* bc_program_vec(const BcProgram *p
 
 static BcNum* bc_program_num(BcProgram *p, BcResult *r) {
 
-       BcNum *n = NULL;
+       BcNum *n;
 
        switch (r->t) {
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to