Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package primecount for openSUSE:Factory 
checked in at 2023-05-13 17:18:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/primecount (Old)
 and      /work/SRC/openSUSE:Factory/.primecount.new.1533 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "primecount"

Sat May 13 17:18:06 2023 rev:10 rq:1086890 version:7.7

Changes:
--------
--- /work/SRC/openSUSE:Factory/primecount/primecount.changes    2022-12-08 
16:52:10.559787405 +0100
+++ /work/SRC/openSUSE:Factory/.primecount.new.1533/primecount.changes  
2023-05-13 17:18:10.626566097 +0200
@@ -1,0 +2,10 @@
+Sat May 13 08:30:00 UTC 2023 - Kim Walisch <kim.wali...@gmail.com>
+
+- Update to primecount-7.7 (API & ABI are backwards compatible).
+- Fix pi(-1) crash.
+- test/api.cpp: Add pi(-1) test.
+- test/api_c.c: Add primecount_pi(-1) test.
+- test/nthprime.cpp: Add new test.
+- primecount.h: Fix -Wstrict-prototypes warning.
+
+-------------------------------------------------------------------

Old:
----
  primecount-7.6.tar.gz

New:
----
  primecount-7.7.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ primecount.spec ++++++
--- /var/tmp/diff_new_pack.IwjvRe/_old  2023-05-13 17:18:11.154569134 +0200
+++ /var/tmp/diff_new_pack.IwjvRe/_new  2023-05-13 17:18:11.158569157 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           primecount
-Version:        7.6
+Version:        7.7
 Release:        0
 Summary:        Count the number of primes
 License:        BSD-2-Clause

++++++ primecount-7.6.tar.gz -> primecount-7.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/CMakeLists.txt 
new/primecount-7.7/CMakeLists.txt
--- old/primecount-7.6/CMakeLists.txt   2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/CMakeLists.txt   2023-03-26 17:45:44.000000000 +0200
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.4...3.22)
 project(primecount CXX)
 set(PRIMECOUNT_VERSION_MAJOR 7)
-set(PRIMECOUNT_VERSION_MINOR 6)
+set(PRIMECOUNT_VERSION_MINOR 7)
 set(PRIMECOUNT_VERSION 
"${PRIMECOUNT_VERSION_MAJOR}.${PRIMECOUNT_VERSION_MINOR}")
 
 # Build options ######################################################
@@ -17,7 +17,7 @@
 option(WITH_LIBDIVIDE       "Use libdivide.h"                       ON)
 option(WITH_OPENMP          "Enable OpenMP multi-threading"         ON)
 option(WITH_MSVC_CRT_STATIC "Link primecount.lib with /MT instead of the 
default /MD" OFF)
-option(WITH_FLOAT128        "Use __float128 (requires libquadmath)" OFF)
+option(WITH_FLOAT128        "Use __float128 (requires libquadmath), increases 
precision of Li(x) & RiemannR" OFF)
 option(WITH_JEMALLOC        "Use jemalloc allocator"                OFF)
 
 # When using WITH_DIV32=ON primecount checks at runtime
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/COPYING new/primecount-7.7/COPYING
--- old/primecount-7.6/COPYING  2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/COPYING  2023-03-26 17:45:44.000000000 +0200
@@ -1,6 +1,6 @@
 BSD 2-Clause License
 
-Copyright (c) 2013 - 2022, Kim Walisch.
+Copyright (c) 2013 - 2023, Kim Walisch.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/ChangeLog new/primecount-7.7/ChangeLog
--- old/primecount-7.6/ChangeLog        2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/ChangeLog        2023-03-26 17:45:44.000000000 +0200
@@ -1,3 +1,15 @@
+Changes in primecount-7.7, 2023-03-26
+
+This is a bug fix release.
+
+* primecount.h: Fix -Wstrict-prototypes warning.
+* api.cpp: Fix pi(-1) crash #64. Now pi(-1) returns 0
+           without reporting any error.
+* test/api.cpp: Add pi(-1) test.
+* test/api_c.cpp: Add primecount_pi(-1) test.
+* test/nthprime.cpp: Add new test.
+* test/api_c.c: Convert api_c.cpp to api_c.c
+
 Changes in primecount-7.6, 2022-12-07
 
 This is a bug fix release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/doc/BUILD.md 
new/primecount-7.7/doc/BUILD.md
--- old/primecount-7.6/doc/BUILD.md     2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/doc/BUILD.md     2023-03-26 17:45:44.000000000 +0200
@@ -110,7 +110,7 @@
 option(WITH_OPENMP          "Enable OpenMP multi-threading"         ON)
 option(WITH_DIV32           "Use 32-bit division instead of 64-bit division 
whenever possible" ON)
 option(WITH_MSVC_CRT_STATIC "Link primecount.lib with /MT instead of the 
default /MD" OFF)
-option(WITH_FLOAT128        "Use __float128 (requires libquadmath)" OFF)
+option(WITH_FLOAT128        "Use __float128 (requires libquadmath), increases 
precision of Li(x) & RiemannR" OFF)
 option(WITH_JEMALLOC        "Use jemalloc allocator"                OFF)
 ```
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/include/primecount.h 
new/primecount-7.7/include/primecount.h
--- old/primecount-7.6/include/primecount.h     2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/include/primecount.h     2023-03-26 17:45:44.000000000 
+0200
@@ -5,7 +5,7 @@
  *        optimized implementations of the combinatorial type
  *        prime counting function algorithms.
  *
- * Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+ * Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
  *
  * This file is distributed under the BSD License.
  */
@@ -16,9 +16,9 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#define PRIMECOUNT_VERSION "7.6"
+#define PRIMECOUNT_VERSION "7.7"
 #define PRIMECOUNT_VERSION_MAJOR 7
-#define PRIMECOUNT_VERSION_MINOR 6
+#define PRIMECOUNT_VERSION_MINOR 7
 
 #ifdef __cplusplus
 extern "C" {
@@ -80,16 +80,16 @@
  * The return type is a char* as primecount_get_max_x() may be a
  * 128-bit integer which is not supported by some compilers.
  */
-const char* primecount_get_max_x();
+const char* primecount_get_max_x(void);
 
 /*  Get the currently set number of threads */
-int primecount_get_num_threads();
+int primecount_get_num_threads(void);
 
 /*  Set the number of threads */
 void primecount_set_num_threads(int num_threads);
 
 /* Get the primecount version number, in the form “i.j” */
-const char* primecount_version();
+const char* primecount_version(void);
 
 #ifdef __cplusplus
 } /* extern "C" */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/include/primecount.hpp 
new/primecount-7.7/include/primecount.hpp
--- old/primecount-7.6/include/primecount.hpp   2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/include/primecount.hpp   2023-03-26 17:45:44.000000000 
+0200
@@ -5,7 +5,7 @@
 ///        optimized implementations of the combinatorial type
 ///        prime counting function algorithms.
 ///
-/// Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
 ///
 /// This file is distributed under the BSD License.
 ///
@@ -17,9 +17,9 @@
 #include <string>
 #include <stdint.h>
 
-#define PRIMECOUNT_VERSION "7.6"
+#define PRIMECOUNT_VERSION "7.7"
 #define PRIMECOUNT_VERSION_MAJOR 7
-#define PRIMECOUNT_VERSION_MINOR 6
+#define PRIMECOUNT_VERSION_MINOR 7
 
 namespace primecount {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/CMakeLists.txt 
new/primecount-7.7/lib/primesieve/CMakeLists.txt
--- old/primecount-7.6/lib/primesieve/CMakeLists.txt    2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/CMakeLists.txt    2023-03-26 
17:45:44.000000000 +0200
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.4...3.22)
 project(primesieve CXX)
-set(PRIMESIEVE_VERSION "11.0")
-set(PRIMESIEVE_SOVERSION "11.0.0")
+set(PRIMESIEVE_VERSION "11.1")
+set(PRIMESIEVE_SOVERSION "11.1.0")
 
 # Build options ######################################################
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/COPYING 
new/primecount-7.7/lib/primesieve/COPYING
--- old/primecount-7.6/lib/primesieve/COPYING   2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/lib/primesieve/COPYING   2023-03-26 17:45:44.000000000 
+0200
@@ -1,6 +1,6 @@
 BSD 2-Clause License
 
-Copyright (c) 2010 - 2022, Kim Walisch.
+Copyright (c) 2010 - 2023, Kim Walisch.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/ChangeLog 
new/primecount-7.7/lib/primesieve/ChangeLog
--- old/primecount-7.6/lib/primesieve/ChangeLog 2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/lib/primesieve/ChangeLog 2023-03-26 17:45:44.000000000 
+0200
@@ -1,3 +1,10 @@
+Changes in version 11.1, 26/13/2023
+===================================
+
+* primesieve.h: Fix -Wstrict-prototypes warning.
+* examples/c/*.c: Fix -Wstrict-prototypes warning.
+* test/*.c: Fix -Wstrict-prototypes warning.
+
 Changes in version 11.0, 02/12/2022
 ===================================
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/README.md 
new/primecount-7.7/lib/primesieve/README.md
--- old/primecount-7.6/lib/primesieve/README.md 2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/lib/primesieve/README.md 2023-03-26 17:45:44.000000000 
+0200
@@ -215,7 +215,7 @@
     </tr>
     <tr>
         <td><b>Python:</b></td>
-        <td><a 
href="https://github.com/kimwalisch/primesieve-python";>primesieve-python</a></td>
+        <td><a 
href="https://github.com/shlomif/primesieve-python";>primesieve-python</a></td>
     </tr>
     <tr>
         <td><b>Raku:</b></td>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/doc/C_API.md 
new/primecount-7.7/lib/primesieve/doc/C_API.md
--- old/primecount-7.6/lib/primesieve/doc/C_API.md      2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/doc/C_API.md      2023-03-26 
17:45:44.000000000 +0200
@@ -54,7 +54,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   primesieve_iterator it;
   primesieve_init(&it);
@@ -95,7 +95,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   primesieve_iterator it;
   primesieve_init(&it);
@@ -137,7 +137,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   primesieve_iterator it;
   primesieve_init(&it);
@@ -173,7 +173,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   primesieve_iterator it;
   primesieve_init(&it);
@@ -205,7 +205,7 @@
 #include <primesieve.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   uint64_t start = 0;
   uint64_t stop = 1000;
@@ -236,7 +236,7 @@
 #include <primesieve.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   uint64_t n = 1000;
   uint64_t start = 0;
@@ -264,7 +264,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   /* primesieve_count_primes(start, stop) */
   uint64_t count = primesieve_count_primes(0, 1000);
@@ -286,7 +286,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   /* primesieve_nth_prime(n, start) */
   uint64_t n = 25;
@@ -311,7 +311,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   uint64_t count = primesieve_count_primes(0, 1000);
 
@@ -449,7 +449,7 @@
 #include <stdio.h>
 #include <omp.h>
 
-int main()
+int main(void)
 {
   uint64_t sum = 0;
   uint64_t dist = 1e10;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/examples/c/count_primes.c 
new/primecount-7.7/lib/primesieve/examples/c/count_primes.c
--- old/primecount-7.6/lib/primesieve/examples/c/count_primes.c 2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/examples/c/count_primes.c 2023-03-26 
17:45:44.000000000 +0200
@@ -5,7 +5,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   uint64_t count = primesieve_count_primes(0, 1000);
   printf("Primes <= 1000: %" PRIu64 "\n", count);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/examples/c/primes_array.c 
new/primecount-7.7/lib/primesieve/examples/c/primes_array.c
--- old/primecount-7.6/lib/primesieve/examples/c/primes_array.c 2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/examples/c/primes_array.c 2023-03-26 
17:45:44.000000000 +0200
@@ -4,7 +4,7 @@
 #include <primesieve.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
   uint64_t start = 0;
   uint64_t stop = 1000;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/include/primesieve.h 
new/primecount-7.7/lib/primesieve/include/primesieve.h
--- old/primecount-7.6/lib/primesieve/include/primesieve.h      2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/include/primesieve.h      2023-03-26 
17:45:44.000000000 +0200
@@ -7,7 +7,7 @@
  *         standard error stream. libprimesieve also sets the C errno
  *         variable to EDOM if an error occurs.
  * 
- * Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+ * Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
  * 
  * This file is distributed under the BSD License.
  */
@@ -15,9 +15,9 @@
 #ifndef PRIMESIEVE_H
 #define PRIMESIEVE_H
 
-#define PRIMESIEVE_VERSION "11.0"
+#define PRIMESIEVE_VERSION "11.1"
 #define PRIMESIEVE_VERSION_MAJOR 11
-#define PRIMESIEVE_VERSION_MINOR 0
+#define PRIMESIEVE_VERSION_MINOR 1
 
 #include <primesieve/iterator.h>
 
@@ -209,13 +209,13 @@
  * Returns the largest valid stop number for primesieve.
  * @return 2^64-1 (UINT64_MAX).
  */
-uint64_t primesieve_get_max_stop();
+uint64_t primesieve_get_max_stop(void);
 
 /** Get the current set sieve size in KiB */
-int primesieve_get_sieve_size();
+int primesieve_get_sieve_size(void);
 
 /** Get the current set number of threads */
-int primesieve_get_num_threads();
+int primesieve_get_num_threads(void);
 
 /**
  * Set the sieve size in KiB (kibibyte).
@@ -240,7 +240,7 @@
 void primesieve_free(void* primes);
 
 /** Get the primesieve version number, in the form “i.j” */
-const char* primesieve_version();
+const char* primesieve_version(void);
 
 #ifdef __cplusplus
 } /* extern "C" */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/include/primesieve.hpp 
new/primecount-7.7/lib/primesieve/include/primesieve.hpp
--- old/primecount-7.6/lib/primesieve/include/primesieve.hpp    2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/include/primesieve.hpp    2023-03-26 
17:45:44.000000000 +0200
@@ -5,7 +5,7 @@
 ///         primesieve::primesieve_error exception (derived form
 ///         std::runtime_error) is thrown.
 ///
-/// Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
 ///
 /// This file is distributed under the BSD License.
 ///
@@ -13,9 +13,9 @@
 #ifndef PRIMESIEVE_HPP
 #define PRIMESIEVE_HPP
 
-#define PRIMESIEVE_VERSION "11.0"
+#define PRIMESIEVE_VERSION "11.1"
 #define PRIMESIEVE_VERSION_MAJOR 11
-#define PRIMESIEVE_VERSION_MINOR 0
+#define PRIMESIEVE_VERSION_MINOR 1
 
 #include <primesieve/iterator.hpp>
 #include <primesieve/primesieve_error.hpp>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/src/api-c.cpp 
new/primecount-7.7/lib/primesieve/src/api-c.cpp
--- old/primecount-7.6/lib/primesieve/src/api-c.cpp     2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/src/api-c.cpp     2023-03-26 
17:45:44.000000000 +0200
@@ -302,12 +302,12 @@
   }
 }
 
-int primesieve_get_sieve_size()
+int primesieve_get_sieve_size(void)
 {
   return get_sieve_size();
 }
 
-int primesieve_get_num_threads()
+int primesieve_get_num_threads(void)
 {
   return get_num_threads();
 }
@@ -322,12 +322,12 @@
   set_num_threads(num_threads);
 }
 
-uint64_t primesieve_get_max_stop()
+uint64_t primesieve_get_max_stop(void)
 {
   return get_max_stop();
 }
 
-const char* primesieve_version()
+const char* primesieve_version(void)
 {
   return PRIMESIEVE_VERSION;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/src/app/help.cpp 
new/primecount-7.7/lib/primesieve/src/app/help.cpp
--- old/primecount-7.6/lib/primesieve/src/app/help.cpp  2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/src/app/help.cpp  2023-03-26 
17:45:44.000000000 +0200
@@ -3,7 +3,7 @@
 /// @brief  help() and version() functions of the primesieve
 ///         console application.
 ///
-/// Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
 ///
 /// This file is distributed under the BSD License. See the COPYING
 /// file in the top level directory.
@@ -57,7 +57,7 @@
 {
   std::cout << "primesieve " << primesieve::primesieve_version();
   std::cout << ", <https://github.com/kimwalisch/primesieve>" << std::endl;
-  std::cout << "Copyright (C) 2010 - 2022 Kim Walisch" << std::endl;
+  std::cout << "Copyright (C) 2010 - 2023 Kim Walisch" << std::endl;
   std::cout << "BSD 2-Clause License 
<https://opensource.org/licenses/BSD-2-Clause>" << std::endl;
   std::exit(0);
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/test/clear_primesieve_iterator2.c 
new/primecount-7.7/lib/primesieve/test/clear_primesieve_iterator2.c
--- old/primecount-7.6/lib/primesieve/test/clear_primesieve_iterator2.c 
2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/clear_primesieve_iterator2.c 
2023-03-26 17:45:44.000000000 +0200
@@ -26,7 +26,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   primesieve_iterator it;
   primesieve_init(&it);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/test/generate_n_primes2.c 
new/primecount-7.7/lib/primesieve/test/generate_n_primes2.c
--- old/primecount-7.6/lib/primesieve/test/generate_n_primes2.c 2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/generate_n_primes2.c 2023-03-26 
17:45:44.000000000 +0200
@@ -61,7 +61,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t i;
   size_t size = 25;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/test/generate_primes2.c 
new/primecount-7.7/lib/primesieve/test/generate_primes2.c
--- old/primecount-7.6/lib/primesieve/test/generate_primes2.c   2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/generate_primes2.c   2023-03-26 
17:45:44.000000000 +0200
@@ -61,7 +61,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t i;
   size_t size = 0;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/test/next_prime2.c 
new/primecount-7.7/lib/primesieve/test/next_prime2.c
--- old/primecount-7.6/lib/primesieve/test/next_prime2.c        2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/next_prime2.c        2023-03-26 
17:45:44.000000000 +0200
@@ -26,7 +26,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t size = 0;
   uint64_t* primes = (uint64_t*) primesieve_generate_primes(0, 100000, &size, 
UINT64_PRIMES);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/lib/primesieve/test/prev_prime2.c 
new/primecount-7.7/lib/primesieve/test/prev_prime2.c
--- old/primecount-7.6/lib/primesieve/test/prev_prime2.c        2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/prev_prime2.c        2023-03-26 
17:45:44.000000000 +0200
@@ -26,7 +26,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t size = 0;
   uint64_t* primes = (uint64_t*) primesieve_generate_primes(0, 100000, &size, 
UINT64_PRIMES);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/test/skipto_next_prime.c 
new/primecount-7.7/lib/primesieve/test/skipto_next_prime.c
--- old/primecount-7.6/lib/primesieve/test/skipto_next_prime.c  2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/skipto_next_prime.c  2023-03-26 
17:45:44.000000000 +0200
@@ -35,7 +35,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t size = 0;
   uint64_t* primes = (uint64_t*) primesieve_generate_primes(0, 100000, &size, 
UINT64_PRIMES);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/primecount-7.6/lib/primesieve/test/skipto_prev_prime.c 
new/primecount-7.7/lib/primesieve/test/skipto_prev_prime.c
--- old/primecount-7.6/lib/primesieve/test/skipto_prev_prime.c  2022-12-07 
16:36:55.000000000 +0100
+++ new/primecount-7.7/lib/primesieve/test/skipto_prev_prime.c  2023-03-26 
17:45:44.000000000 +0200
@@ -35,7 +35,7 @@
   }
 }
 
-int main()
+int main(void)
 {
   size_t size = 0;
   uint64_t* primes = (uint64_t*) primesieve_generate_primes(0, 100000, &size, 
UINT64_PRIMES);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/src/api.cpp 
new/primecount-7.7/src/api.cpp
--- old/primecount-7.6/src/api.cpp      2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/src/api.cpp      2023-03-26 17:45:44.000000000 +0200
@@ -46,6 +46,9 @@
     print("threads", 1);
   }
 
+  if (x < 2)
+    return 0;
+
   return PiTable::pi_cache(x);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/src/api_c.cpp 
new/primecount-7.7/src/api_c.cpp
--- old/primecount-7.6/src/api_c.cpp    2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/src/api_c.cpp    2023-03-26 17:45:44.000000000 +0200
@@ -97,7 +97,7 @@
   }
 }
 
-int primecount_get_num_threads()
+int primecount_get_num_threads(void)
 {
   try
   {
@@ -122,7 +122,7 @@
   }
 }
 
-const char* primecount_get_max_x()
+const char* primecount_get_max_x(void)
 {
 #ifdef HAVE_INT128_T
   // 10^31
@@ -133,7 +133,7 @@
 #endif
 }
 
-const char* primecount_version()
+const char* primecount_version(void)
 {
   return PRIMECOUNT_VERSION;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/src/app/help.cpp 
new/primecount-7.7/src/app/help.cpp
--- old/primecount-7.6/src/app/help.cpp 2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/src/app/help.cpp 2023-03-26 17:45:44.000000000 +0200
@@ -1,7 +1,7 @@
 ///
 /// @file  help.cpp
 ///
-/// Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
 ///
 /// This file is distributed under the BSD License. See the COPYING
 /// file in the top level directory.
@@ -74,7 +74,7 @@
 {
   const std::string versionInfo =
     "primecount " PRIMECOUNT_VERSION ", 
<https://github.com/kimwalisch/primecount>\n"
-    "Copyright (C) 2013 - 2022 Kim Walisch\n"
+    "Copyright (C) 2013 - 2023 Kim Walisch\n"
     "BSD 2-Clause License <https://opensource.org/licenses/BSD-2-Clause>";
 
   std::cout << versionInfo << std::endl;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/src/nth_prime.cpp 
new/primecount-7.7/src/nth_prime.cpp
--- old/primecount-7.6/src/nth_prime.cpp        2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/src/nth_prime.cpp        2023-03-26 17:45:44.000000000 
+0200
@@ -57,6 +57,11 @@
   int64_t low = n * 2;
   int64_t hi = PiTable::max_cached();
 
+  ASSERT(low < hi);
+  ASSERT(n >= 1);
+  ASSERT(n >= PiTable::pi_cache(low));
+  ASSERT(n <= PiTable::pi_cache(hi));
+
   while (low < hi)
   {
     int64_t mid = low + (hi - low) / 2;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/src/phi.cpp 
new/primecount-7.7/src/phi.cpp
--- old/primecount-7.6/src/phi.cpp      2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/src/phi.cpp      2023-03-26 17:45:44.000000000 +0200
@@ -326,6 +326,7 @@
 ///
 int64_t pix_upper(int64_t x)
 {
+  ASSERT(x >= 0);
   if (x <= PiTable::max_cached())
     return PiTable::pi_cache(x);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/test/CMakeLists.txt 
new/primecount-7.7/test/CMakeLists.txt
--- old/primecount-7.6/test/CMakeLists.txt      2022-12-07 16:36:55.000000000 
+0100
+++ new/primecount-7.7/test/CMakeLists.txt      2023-03-26 17:45:44.000000000 
+0200
@@ -1,4 +1,5 @@
-file(GLOB files "*.cpp")
+enable_language(C)
+file(GLOB files "*.cpp" "*.c")
 
 foreach(file ${files})
     get_filename_component(binary_name ${file} NAME_WE)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/test/api.cpp 
new/primecount-7.7/test/api.cpp
--- old/primecount-7.6/test/api.cpp     2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/test/api.cpp     2023-03-26 17:45:44.000000000 +0200
@@ -2,7 +2,7 @@
 /// @file   api.cpp
 /// @brief  Test primecount's C++ API.
 ///
-/// Copyright (C) 2020 Kim Walisch, <kim.wali...@gmail.com>
+/// Copyright (C) 2022 Kim Walisch, <kim.wali...@gmail.com>
 ///
 /// This file is distributed under the BSD License. See the COPYING
 /// file in the top level directory.
@@ -32,9 +32,21 @@
   set_num_threads(3);
   std::cout << "new threads: " << get_num_threads() << std::endl;
 
-  int64_t n = (int64_t) 1e10;
+  // Test 64-bit pi(-1)
+  int64_t n = -1;
   int64_t res = pi(n);
   std::cout << "pi(" << n << ") = " << res;
+  check(res == 0);
+
+  // Test 128-bit pi(-1)
+  std::string in = "-1";
+  std::string out = pi(in);
+  std::cout << "pi(" << in << ") = " << out;
+  check(out == "0");
+
+  n = (int64_t) 1e10;
+  res = pi(n);
+  std::cout << "pi(" << n << ") = " << res;
   check(res == 455052511);
 
   n = 455052511;
@@ -48,8 +60,8 @@
   std::cout << "phi(" << n << ", " << a << ") = " << res;
   check(res == 37607833521);
 
-  std::string in("1000000000000");
-  std::string out = pi(in);
+  in = "1000000000000";
+  out = pi(in);
   std::cout << "pi(" << in << ") = " << out;
   check(out == "37607912018");
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/test/api_c.c 
new/primecount-7.7/test/api_c.c
--- old/primecount-7.6/test/api_c.c     1970-01-01 01:00:00.000000000 +0100
+++ new/primecount-7.7/test/api_c.c     2023-03-26 17:45:44.000000000 +0200
@@ -0,0 +1,87 @@
+///
+/// @file   api_c.c
+/// @brief  Test primecount's C API.
+///
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
+///
+/// This file is distributed under the BSD License. See the COPYING
+/// file in the top level directory.
+///
+
+#include <primecount.h>
+
+#include <stdint.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+void check(int OK)
+{
+  if (OK)
+    printf("   OK\n");
+  else
+  {
+    printf("   ERROR\n");
+    exit(1);
+  }
+}
+
+int main(void)
+{
+  printf("primecount version: %s\n", primecount_version());
+  printf("threads: %d\n", primecount_get_num_threads());
+  
+  primecount_set_num_threads(3);
+  printf("new threads: %d\n", primecount_get_num_threads());
+
+  // Test 64-bit pi(-1)
+  int64_t n = -1;
+  int64_t res = primecount_pi(n);
+  printf("primecount_pi(%"PRId64") = %"PRId64, n, res);
+  check(res == 0);
+
+  // Test 128-bit pi(-1)
+  char out[32];
+  primecount_pi_str("-1", out, sizeof(out));
+  printf("primecount_pi_str(-1) = %s", out);
+  check(strcmp(out, "0") == 0);
+
+  n = (int64_t) 1e10;
+  res = primecount_pi(n);
+  printf("primecount_pi(%"PRId64") = %"PRId64, n, res);
+  check(res == 455052511);
+
+  n = 455052511;
+  res = primecount_nth_prime(n);
+  printf("primecount_nth_prime(%"PRId64") = %"PRId64, n, res);
+  check(res == 9999999967);
+
+  // nth_prime(-1) is an error and should hence return -1
+  // which indicates an error in the libprimecount C API.
+  n = -1;
+  res = primecount_nth_prime(n);
+  printf("primecount_nth_prime(%"PRId64") = %"PRId64, n, res);
+  check(res == -1);
+
+  n = (int64_t) 1e12;
+  int64_t a = 78498;
+  res = primecount_phi(n, a);
+  printf("primecount_phi(%"PRId64", %"PRId64") = %"PRId64, n , a, res);
+  check(res == 37607833521);
+
+  n = -1;
+  res = primecount_phi(n, a);
+  printf("primecount_phi(%"PRId64", %"PRId64") = %"PRId64, n , a, res);
+  check(res == 0);
+
+  const char* in = "1000000000000";
+  primecount_pi_str(in, out, sizeof(out));
+  printf("primecount_pi_str(%s) = %s", in, out);
+  check(strcmp(out, "37607912018") == 0);
+
+  printf("\n");
+  printf("All tests passed successfully!\n");
+
+  return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/test/api_c.cpp 
new/primecount-7.7/test/api_c.cpp
--- old/primecount-7.6/test/api_c.cpp   2022-12-07 16:36:55.000000000 +0100
+++ new/primecount-7.7/test/api_c.cpp   1970-01-01 01:00:00.000000000 +0100
@@ -1,59 +0,0 @@
-///
-/// @file   api_c.cpp
-/// @brief  Test primecount's C API.
-///
-/// Copyright (C) 2020 Kim Walisch, <kim.wali...@gmail.com>
-///
-/// This file is distributed under the BSD License. See the COPYING
-/// file in the top level directory.
-///
-
-#include <primecount.h>
-
-#include <stdint.h>
-#include <iostream>
-#include <string>
-#include <cstdlib>
-
-void check(bool OK)
-{
-  std::cout << "   " << (OK ? "OK" : "ERROR") << "\n";
-  if (!OK)
-    std::exit(1);
-}
-
-int main()
-{
-  std::cout << "primecount version: " << primecount_version() << std::endl;
-  std::cout << "threads: " << primecount_get_num_threads() << std::endl;
-  
-  primecount_set_num_threads(3);
-  std::cout << "new threads: " << primecount_get_num_threads() << std::endl;
-
-  int64_t n = (int64_t) 1e10;
-  int64_t res = primecount_pi(n);
-  std::cout << "primecount_pi(" << n << ") = " << res;
-  check(res == 455052511);
-
-  n = 455052511;
-  res = primecount_nth_prime(n);
-  std::cout << "primecount_nth_prime(" << n << ") = " << res;
-  check(res == 9999999967);
-
-  n = (int64_t) 1e12;
-  int64_t a = 78498;
-  res = primecount_phi(n, a);
-  std::cout << "primecount_phi(" << n << ", " << a << ") = " << res;
-  check(res == 37607833521);
-
-  const char* in = "1000000000000";
-  char out[32];
-  primecount_pi_str(in, out, 32);
-  std::cout << "primecount_pi_str(" << in << ") = " << out;
-  check(std::string(out) == "37607912018");
-
-  std::cout << std::endl;
-  std::cout << "All tests passed successfully!" << std::endl;
-
-  return 0;
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/primecount-7.6/test/nthprime.cpp 
new/primecount-7.7/test/nthprime.cpp
--- old/primecount-7.6/test/nthprime.cpp        1970-01-01 01:00:00.000000000 
+0100
+++ new/primecount-7.7/test/nthprime.cpp        2023-03-26 17:45:44.000000000 
+0200
@@ -0,0 +1,63 @@
+///
+/// @file   nthprime.cpp
+/// @brief  Test the nth_prime(n) function
+///
+/// Copyright (C) 2023 Kim Walisch, <kim.wali...@gmail.com>
+///
+/// This file is distributed under the BSD License. See the COPYING
+/// file in the top level directory.
+///
+
+#include <primecount.hpp>
+#include <primesieve.hpp>
+#include <PiTable.hpp>
+
+#include <stdint.h>
+#include <iostream>
+#include <cstdlib>
+#include <random>
+
+using namespace primecount;
+
+void check_equal(int64_t x,
+                 int64_t res1,
+                 int64_t res2)
+{
+  bool OK = (res1 == res2);
+  std::cout << "nth_prime(" << x << ") = " << res1 << "   " << (OK ? "OK" : 
"ERROR") << "\n";
+  if (!OK)
+    std::exit(1);
+}
+
+int main()
+{
+  int64_t n = 1;
+  int64_t prime = 0;
+  int64_t limit_small = PiTable::max_cached() + 100;
+  primesieve::iterator iter;
+
+  for (; n < limit_small; n++)
+  {
+    prime = iter.next_prime();
+    check_equal(n, nth_prime(n), prime);
+  }
+
+  std::random_device rd;
+  std::mt19937 gen(rd());
+  std::uniform_int_distribution<int64_t> dist(1, 100000);
+  n = limit_small - 1;
+
+  // Test random increment
+  for (int64_t i = 0; i < 100; i++)
+  {
+    int64_t next = dist(gen);
+    n += next;
+    prime = primesieve::nth_prime(next, prime);
+    check_equal(n, nth_prime(n), prime);
+  }
+
+  std::cout << std::endl;
+  std::cout << "All tests passed successfully!" << std::endl;
+
+  return 0;
+}

Reply via email to