Re: git: 29c5f8bf9a01 - main - config: drop dependency on libnv

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 22 Feb 2023 21:41:39 UTC
On 2/7/23 10:10 PM, Kyle Evans wrote:
> The branch main has been updated by kevans:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=29c5f8bf9a011d92462977bae59b4889ec5d95ad
> 
> commit 29c5f8bf9a011d92462977bae59b4889ec5d95ad
> Author:     Kyle Evans <kevans@FreeBSD.org>
> AuthorDate: 2023-02-08 06:02:56 +0000
> Commit:     Kyle Evans <kevans@FreeBSD.org>
> CommitDate: 2023-02-08 06:09:19 +0000
> 
>      config: drop dependency on libnv
>      
>      Compile mkmakefile.c as C++ instead and use an std::unordered_map to
>      accomplish the same goal.
>      
>      Reviewed by:    imp
>      Sponsored by:   Klara, Inc.
>      Sponsored by:   NetApp, Inc.
>      Differential Revision:  https://reviews.freebsd.org/D38275

I'm not quite sure how to fix it, but I believe this change is what has broken
the clang-12 cross-build jobs on GitHub's actions.  The error is a mismatch
in the declarations of getopt() as the Linux one adds a 'throw ()' specifier.

Note that clang-13 on the newer Ubuntu 22.04 builds file.  I haven't tried
examining the includes on 22.04 to see what has changed to avoid the error
there.

Here is the error from a recent run:

In file included from /usr/include/x86_64-linux-gnu/bits/getopt_posix.h:27,
14356
                  from /usr/include/unistd.h:869,
14357
                  from /home/runner/work/freebsd-src/freebsd-src/tools/build/cross-build/include/linux/unistd.h:53,
14358
                  from /home/runner/work/freebsd-src/freebsd-src/tools/build/cross-build/include/common/unistd.h:39,
14359
                  from /home/runner/work/freebsd-src/freebsd-src/usr.sbin/config/main.cc:61:
14360
/usr/include/x86_64-linux-gnu/bits/getopt_core.h:91:12: error: declaration of ‘int getopt(int, char* const*, const char*) throw ()’ has a different exception specifier
14361
    91 | extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
14362
       |            ^~~~~~
14363
In file included from /home/runner/work/freebsd-src/freebsd-src/tools/build/cross-build/include/linux/unistd.h:52,
14364
                  from /home/runner/work/freebsd-src/freebsd-src/tools/build/cross-build/include/common/unistd.h:39,
14365
                  from /home/runner/work/freebsd-src/freebsd-src/usr.sbin/config/main.cc:61:
14366
/home/runner/work/freebsd-src/build/home/runner/work/freebsd-src/freebsd-src/amd64.amd64/tmp/legacy/usr/include/getopt.h:69:6: note: from previous declaration ‘int getopt(int, char* const*, const char*)’
14367
    69 | int  getopt(int, char * const [], const char *);
14368
       |      ^~~~~~

(FWIW, one odd thing here that I can't figure out yet is that it appears that
our local getopt.h was #included prior to the unistd.h wrapper which I think
is probably the root issue, may just need to wrap some other header?)

-- 
John Baldwin