Bug 96276 - Wrong configure of option -Werror=main
Summary: Wrong configure of option -Werror=main
Status: RESOLVED INVALID
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: git
Hardware: Other Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-30 14:42 UTC by Timur Mustafin
Modified: 2018-05-15 19:20 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Timur Mustafin 2016-05-30 14:42:38 UTC
Hello!

We want to compile xserver_xorg and get an error:
lcc: "../../dix/main.c", line 133: error: nonstandard number of parameters for
          "main", expected zero or two parameters [-Werror=main]
  main(int argc, char *argv[], char *envp[])

It happens due to conftest and real program difference.
While configure script checks if $CC supports -Werror=main option the conftest program is:

int i;
int
main ()
{

  ;
  return 0;
}

The main function in conftest has no parameters. However main function in dix/main.c has 3 parameters:

dix_main(int argc, char *argv[], char *envp[])

The difference leads to compilation error:

lcc: "../../dix/main.c", line 133: error: nonstandard number of parameters for
          "main", expected zero or two parameters [-Werror=main]
  main(int argc, char *argv[], char *envp[])

We can avoid the error by pass --disable-selective-werror to configure script. But  aclocal.m4 file contains recommendation: 
"You have chosen not to turn some select compiler warnings into errors.  This should not be necessary.  Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT". So you can see the bug.
Comment 1 Adam Jackson 2018-05-15 19:20:33 UTC
If your compiler doesn't understand the three-argument form of main that's not X's fault.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.