Long time ago this looked like:
https://github.com/FluidSynth/fluidsynth/blame/c9193d8f8182cd26785f6fdda502dbcad783ccbc/fluidsynth/src/fluidsynth.c#L90-L94

Perhaps these declarations were missing in the header at that time and
manually added. I think it's redundant nowadays and removed it
<https://github.com/FluidSynth/fluidsynth/commit/456b6afa976b395b6cf28097d61fab14c0e90b8b>.
In fact we dont even need getopt() as we are using getopt_long(). While
getopt() is posix standard, getopt_long() is a GNU extension. So when
getopt.h we currently rely on the fact that it provides GNU extensions.


Tom


2017-10-22 12:23 GMT+02:00 Marcus Weseloh <mar...@weseloh.cc>:

> 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. <tom.m...@googlemail.com>:
>
>> 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 <carlo.bra...@libero.it>:
>>
>>> 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
>>> fluid-dev@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>>>
>>
>>
>> _______________________________________________
>> fluid-dev mailing list
>> fluid-dev@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>>
>>
>
> _______________________________________________
> fluid-dev mailing list
> fluid-dev@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/fluid-dev
>
>
_______________________________________________
fluid-dev mailing list
fluid-dev@nongnu.org
https://lists.nongnu.org/mailman/listinfo/fluid-dev

Reply via email to