[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [fluid-dev] Current code overrides getopt.h declarations on Windows
From: |
Carlo Bramini |
Subject: |
Re: [fluid-dev] Current code overrides getopt.h declarations on Windows |
Date: |
Sun, 22 Oct 2017 16:37:20 +0200 (CEST) |
Hello
you are right, I did not noticed that thing: that ugly addition on top of
fluidsynth.c declares extern getopt(), but in the later code it is using
getopt_long(). So, the re-declaration of getopt() looks more useless to me. You
may want to re-declare getopt_long() instead, but I doubt that somebody
complained its absence until now.
Sincerely.
> Il 22 ottobre 2017 alle 16.24 "Tom M." <address@hidden> ha scritto:
>
> > If HAVE_GETOPT is defined, let's use the function.
>
> We dont rely on getopt, fluidsynth.c will do the parsing itself if it's not
> present. The bigger problem is that getopt_long() may or may not be present
> in getopt.h. But so far I havent seen a getopt.h that doesnt provide it.
>
> Tom
>
> 2017-10-22 14:20 GMT+02:00 Carlo Bramini <address@hidden>:
>
> > Hello,
> > in my opinion, that piece of code should be removed.
> > The proper presence of getopt.h and the support of getopt() function
> > should be tested by cmake.
> > If HAVE_GETOPT_H is defined, let's include the file.
> > If HAVE_GETOPT is defined, let's use the function.
> >
> > What do you think?
> >
> > Sincerely.
> >
> > > Il 22 ottobre 2017 alle 12.23 Marcus Weseloh <address@hidden> ha scritto:
> > >
> > > Hi,
> > >
> > > to me it looks like somebody read the getopt man page and took the
> > > synopsis as a usage example and not as a short description of the header
> > > file contents. I think the lines
> > >
> > > int getopt(int argc, char * const argv[], const char *optstring);
> > > extern char *optarg;
> > > extern int optind, opterr, optopt;
> > >
> > > can safely be removed.
> > >
> > > Cheers,
> > >
> > > Marcus
> > >
> > > 2017-10-21 17:06 GMT+02:00 Tom M. <address@hidden>:
> > >
> > > > clang-tidy also remarks that on Linux. Not sure why it has been done
> > > > that way.
> > > >
> > > > Tom
> > > >
> > > > 2017-10-21 17:01 GMT+02:00 Carlo Bramini <address@hidden>:
> > > >
> > > > > Hello,
> > > > > when compiling Fluidsynth on Windows, the compiler prints these
> > > > >messages into the console:
> > > > >
> > > > > [ 97%] Building C object src/CMakeFiles/fluidsynth.dir/fluidsynth.c.o
> > > > > /home/Carlo/fluidsynth/src/fluidsynth.c:67:14: warning: 'optarg'
> > > > >redeclared with out dllimport attribute: previous dllimport ignored
> > > > >[-Wattributes]
> > > > > extern char *optarg;
> > > > > ^~~~~~
> > > > > /home/Carlo/fluidsynth/src/fluidsynth.c:68:12: warning: 'optind'
> > > > >redeclared with out dllimport attribute: previous dllimport ignored
> > > > >[-Wattributes]
> > > > > extern int optind, opterr, optopt;
> > > > > ^~~~~~
> > > > > /home/Carlo/fluidsynth/src/fluidsynth.c:68:20: warning: 'opterr'
> > > > >redeclared with out dllimport attribute: previous dllimport ignored
> > > > >[-Wattributes]
> > > > > extern int optind, opterr, optopt;
> > > > > ^~~~~~
> > > > > /home/Carlo/fluidsynth/src/fluidsynth.c:68:28: warning: 'optopt'
> > > > >redeclared with out dllimport attribute: previous dllimport ignored
> > > > >[-Wattributes]
> > > > > extern int optind, opterr, optopt;
> > > > > ^~~~~~
> > > > >
> > > > > and actually it is right, because inside src/fluidsynth.c these
> > > > >variables are re-declarated and the dllimport attribute applied to
> > > > >them inside getopt.h is lost.
> > > > > Is there a particular reason for doing this thing?
> > > > >
> > > > > Sincerely,
> > > > >
> > > > > Carlo Bramini.
> > > > >
> > > > > _______________________________________________
> > > > > fluid-dev mailing list
> > > > > address@hidden
> >
> > > > >
> > > > >[[https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev)](https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev))
> > > >
> > > > _______________________________________________
> > > > fluid-dev mailing list
> > > > address@hidden
> > > >
> > > >[[https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev)](https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev))
> >
> > >
> > > _______________________________________________
> > > fluid-dev mailing list
> > > address@hidden
> > > [https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev)
> >
> > _______________________________________________
> > fluid-dev mailing list
> > address@hidden
> >
> > [https://lists.nongnu.org/mailman/listinfo/fluid-dev](https://lists.nongnu.org/mailman/listinfo/fluid-dev)
>
> _______________________________________________
> fluid-dev mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fluid-dev