[1/6] lib: Add missing config.h include to next_prime.c

Message ID 20241010102559.9162-2-mcpratt@pm.me
State Committed
Headers
Series Various portability fixes and organization |

Commit Message

Michael Pratt Oct. 10, 2024, 10:26 a.m. UTC
  This is the last remaining C source file as of this commit
without the standard conditional inclusion of config.h
as the very first header.

      * lib/next_prime.c: add missing config.h header.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
---
 lib/next_prime.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Mark Wielaard Oct. 14, 2024, 8:38 p.m. UTC | #1
Hi Michael,

On Thu, Oct 10, 2024 at 10:26:54AM +0000, Michael Pratt wrote:
> This is the last remaining C source file as of this commit
> without the standard conditional inclusion of config.h
> as the very first header.
> 
>       * lib/next_prime.c: add missing config.h header.

Looks good and is more consistent. Pushed.

There isn't much code in this file. What kind of build issue are you
seeing without this? Does config.h contain some construct that affects
the build of this file?

Thanks,

Mark
  
Michael Pratt Oct. 15, 2024, 2:50 p.m. UTC | #2
Hi Mark,

On Monday, October 14th, 2024 at 16:38, Mark Wielaard <mark@klomp.org> wrote:

> 
> 
> There isn't much code in this file. What kind of build issue are you
> seeing without this? Does config.h contain some construct that affects
> the build of this file?


Like I mentioned in the cover letter, we incorporate gnulib to the build,
so the build simply fails due to their strict requirements
of including config.h before including any other header that gnulib provides.

I'm not familiar with the exact reason for this requirement,
but I'm sure it could potentially cause a problem if one overrides it.

--
MCP
  

Patch

diff --git a/lib/next_prime.c b/lib/next_prime.c
index f2c921e3..97c425e1 100644
--- a/lib/next_prime.c
+++ b/lib/next_prime.c
@@ -27,6 +27,10 @@ 
    the GNU Lesser General Public License along with this program.  If
    not, see <http://www.gnu.org/licenses/>.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <stddef.h>