Fix builds of Xnest & Xephyr with Solaris Studio compilers

Required in order to build with Studio cc now that xorg-macros is
setting -errwarn=E_FUNC_HAS_NO_RETURN_STMT since a bug in the Solaris
system headers causes the noreturn attribute to not be correctly
applied to the exit() prototype in <stdlib.h> when building with
Studio instead of gcc.

Otherwise compiler exits with errors:
"Display.c", line 65: Function has no return statement : x_io_error_handler
"hostx.c", line 341: Function has no return statement : x_io_error_handler

Uses Studio-specific pragma instead of adding another exit() prototype
with a noreturn attribute to avoid causing gcc to warn about having
a redundant prototype for the exit() function.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
This commit is contained in:
Alan Coopersmith 2011-12-02 00:09:07 -08:00
parent e4dcf580f0
commit c19c55a93a
2 changed files with 10 additions and 0 deletions

View File

@ -332,6 +332,11 @@ hostx_set_title (char *title)
ephyrTitle = title;
}
#ifdef __SUNPRO_C
/* prevent "Function has no return statement" error for x_io_error_handler */
#pragma does_not_return(exit)
#endif
static int _X_NORETURN
x_io_error_handler (Display *dpy) {
ErrorF("Lost connection to X server: %s\n", strerror(errno));

View File

@ -55,6 +55,11 @@ Pixmap xnestScreenSaverPixmap;
XlibGC xnestBitmapGC;
unsigned long xnestEventMask;
#ifdef __SUNPRO_C
/* prevent "Function has no return statement" error for x_io_error_handler */
#pragma does_not_return(exit)
#endif
static int _X_NORETURN
x_io_error_handler (Display *dpy) {
ErrorF("Lost connection to X server: %s\n", strerror(errno));