[PATCH] vsh: Define HAVE_STDARG_H before including readline

Michal Privoznik posted 1 patch 3 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/4f8dbd332899483a3a24ea4c793cb1ec759d8a9f.1599061663.git.mprivozn@redhat.com
tools/vsh.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] vsh: Define HAVE_STDARG_H before including readline
Posted by Michal Privoznik 3 years, 7 months ago
As it turned out my previous commits which switched from HAVE_ to
WITH_ and dropped stdarg.h detection were a bit too aggressive.
Because of reasons described in 9ea3424a178 we need to define
HAVE_STDARG_H before including readline otherwise macos build
fails. Honestly, I still don't fully understand the problem so I
am not going to bother you with "explanation".

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tools/vsh.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/vsh.c b/tools/vsh.c
index 11f493f969..d063a7f8cb 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -30,6 +30,10 @@
 #include <signal.h>
 
 #if WITH_READLINE
+/* In order to have proper rl_message declaration with older
+ * versions of readline, we have to declare this. See 9ea3424a178
+ * for more info. */
+# define HAVE_STDARG_H
 # include <readline/readline.h>
 # include <readline/history.h>
 #endif
-- 
2.26.2

Re: [PATCH] vsh: Define HAVE_STDARG_H before including readline
Posted by Pavel Hrdina 3 years, 7 months ago
On Wed, Sep 02, 2020 at 05:47:43PM +0200, Michal Privoznik wrote:
> As it turned out my previous commits which switched from HAVE_ to
> WITH_ and dropped stdarg.h detection were a bit too aggressive.
> Because of reasons described in 9ea3424a178 we need to define
> HAVE_STDARG_H before including readline otherwise macos build
> fails. Honestly, I still don't fully understand the problem so I
> am not going to bother you with "explanation".
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tools/vsh.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/tools/vsh.c b/tools/vsh.c
> index 11f493f969..d063a7f8cb 100644
> --- a/tools/vsh.c
> +++ b/tools/vsh.c
> @@ -30,6 +30,10 @@
>  #include <signal.h>
>  
>  #if WITH_READLINE
> +/* In order to have proper rl_message declaration with older
> + * versions of readline, we have to declare this. See 9ea3424a178
> + * for more info. */
> +# define HAVE_STDARG_H
>  # include <readline/readline.h>
>  # include <readline/history.h>
>  #endif

Is this enough to fix the issue? As we include readline.h in virsh.c and
virt-admin.c as well.

Pavel
Re: [PATCH] vsh: Define HAVE_STDARG_H before including readline
Posted by Roman Bogorodskiy 3 years, 7 months ago
  Pavel Hrdina wrote:

> On Wed, Sep 02, 2020 at 05:47:43PM +0200, Michal Privoznik wrote:
> > As it turned out my previous commits which switched from HAVE_ to
> > WITH_ and dropped stdarg.h detection were a bit too aggressive.
> > Because of reasons described in 9ea3424a178 we need to define
> > HAVE_STDARG_H before including readline otherwise macos build
> > fails. Honestly, I still don't fully understand the problem so I
> > am not going to bother you with "explanation".
> > 
> > Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> > ---
> >  tools/vsh.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/tools/vsh.c b/tools/vsh.c
> > index 11f493f969..d063a7f8cb 100644
> > --- a/tools/vsh.c
> > +++ b/tools/vsh.c
> > @@ -30,6 +30,10 @@
> >  #include <signal.h>
> >  
> >  #if WITH_READLINE
> > +/* In order to have proper rl_message declaration with older
> > + * versions of readline, we have to declare this. See 9ea3424a178
> > + * for more info. */
> > +# define HAVE_STDARG_H
> >  # include <readline/readline.h>
> >  # include <readline/history.h>
> >  #endif
> 
> Is this enough to fix the issue? As we include readline.h in virsh.c and
> virt-admin.c as well.
> 
> Pavel

It's not enough, at least to fix build on FreeBSD. Like you said, I had
to make similar change in tools/virsh.c and tools/virt-admin.c to get a
successful build.

Roman Bogorodskiy