[Mesa-dev] [PATCH 3/3] aubinator: only use program_invocation_short_name with glibc/cygwin

Jonathan Gray jsg at jsg.id.au
Mon Sep 12 06:44:40 UTC 2016


On Mon, Sep 12, 2016 at 09:28:58AM +1000, Timothy Arceri wrote:
> On Thu, 2016-09-08 at 18:39 +0100, Emil Velikov wrote:
> > On 1 September 2016 at 18:12, Jonathan Gray <jsg at jsg.id.au> wrote:
> > > 
> > > program_invocation_short_name is a gnu extension.????Limit use of it
> > > to glibc and cygwin and otherwise use getprogname() which is
> > > available
> > > on BSD and OS X.
> > > 
> > > Signed-off-by: Jonathan Gray <jsg at jsg.id.au>
> > > ---
> > > ??src/intel/tools/aubinator.c | 8 +++++++-
> > > ??1 file changed, 7 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/intel/tools/aubinator.c
> > > b/src/intel/tools/aubinator.c
> > > index df84469..fe1f369 100644
> > > --- a/src/intel/tools/aubinator.c
> > > +++ b/src/intel/tools/aubinator.c
> > > @@ -1014,6 +1014,12 @@ setup_pager(void)
> > > ??static void
> > > ??print_help(FILE *file)
> > > ??{
> > > +??????const char *progname;
> > > +#if defined(__GLIBC__) || defined(__CYGWIN__)
> > > +??????progname = program_invocation_short_name;
> > > +#else
> > > +??????progname = getprogname();
> > > +#endif
> > We could really fold the ~5 hunks somehow. Then again it shouldn't
> > block this fix from getting it.
> > 
> > R-b and pushed the series. Thanks !
> > Emil
> 
> This is causing a warning in GCC:
> 
> aubinator.c: In function ???print_help???:
> aubinator.c:1034:21: warning: passing argument 1 of ???__xpg_basename???
> discards ???const??? qualifier from pointer target type [-Wdiscarded-
> qualifiers]
> ????????????????????????basename(progname));
> ??????????????????????????????????????????^~~~~~~~
> In file included from aubinator.c:33:0:
> /usr/include/libgen.h:34:14: note: expected ???char *??? but argument is of
> type ???const char *???
> ??extern char *__xpg_basename (char *__path) __THROW;
> ????????????????????????????^~~~~~~~~~~~~~

getprogname() returns const, it seems odd that program_invocation_short_name
would not be as well.

Note that the gallium code in src/gallium/auxiliary/os/os_process.c
os_get_process_name() also stores program_invocation_short_name in
"const char *".


More information about the mesa-dev mailing list