From b0a241cf7c7ab3840929da3b1aabdda7bab22517 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Tue, 17 May 2005 08:10:10 +0000 Subject: gcc4 allows to check if sentinels are correct (a sentinel is the terminating element in a varargs list). A sentinel needs to be NULL, not 0 - which doesn't make a difference on 32bit but matters on 64bit. Furthermore it can be told that functions have a printf-like format string and argument list so that they can verify that both match. To use these features certain attributes need to be set - which are compiler specific. To do this we define macros which are expanded depending on the compiler version. For now we put those in include/Xfuncproto.h (the XFree86 DDX layer contains a file compiler.h which however is not visible outside the DDX) (Bugzilla #3268). --- include/X11/Intrinsic.h | 26 +++++++++++++------------- include/X11/IntrinsicI.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/X11/Intrinsic.h b/include/X11/Intrinsic.h index 7709a38..0461b84 100644 --- a/include/X11/Intrinsic.h +++ b/include/X11/Intrinsic.h @@ -1178,7 +1178,7 @@ extern ArgList XtMergeArgLists( extern XtVarArgsList XtVaCreateArgsList( XtPointer /*unused*/, ... -); +) _X_SENTINEL(0); /************************************************************* * @@ -1322,7 +1322,7 @@ extern Widget XtVaCreatePopupShell( WidgetClass /* widgetClass */, Widget /* parent */, ... -); +) _X_SENTINEL(0); extern void XtPopup( Widget /* popup_shell */, @@ -1389,14 +1389,14 @@ extern Widget XtVaCreateWidget( WidgetClass /* widget */, Widget /* parent */, ... -); +) _X_SENTINEL(0); extern Widget XtVaCreateManagedWidget( _Xconst _XtString /* name */, WidgetClass /* widget_class */, Widget /* parent */, ... -); +) _X_SENTINEL(0); extern Widget XtCreateApplicationShell( /* obsolete */ _Xconst _XtString /* name */, @@ -1420,7 +1420,7 @@ extern Widget XtVaAppCreateShell( WidgetClass /* widget_class */, Display* /* display */, ... -); +) _X_SENTINEL(0); /**************************************************************** * @@ -1472,7 +1472,7 @@ extern Widget XtVaOpenApplication( String* /* fallback_resources */, WidgetClass /* widget_class */, ... -); +) _X_SENTINEL(0); extern Widget XtAppInitialize( /* obsolete */ XtAppContext* /* app_context_return */, @@ -1495,7 +1495,7 @@ extern Widget XtVaAppInitialize( /* obsolete */ String* /* argv_in_out */, String* /* fallback_resources */, ... -); +) _X_SENTINEL(0); extern Widget XtInitialize( /* obsolete */ _Xconst _XtString /* shell_name */, @@ -1569,7 +1569,7 @@ extern void XtVaGetApplicationResources( XtResourceList /* resources */, Cardinal /* num_resources */, ... -); +) _X_SENTINEL(0); extern void XtGetSubresources( Widget /* widget */, @@ -1590,7 +1590,7 @@ extern void XtVaGetSubresources( XtResourceList /* resources */, Cardinal /* num_resources */, ... -); +) _X_SENTINEL(0); extern void XtSetValues( Widget /* widget */, @@ -1601,7 +1601,7 @@ extern void XtSetValues( extern void XtVaSetValues( Widget /* widget */, ... -); +) _X_SENTINEL(0); extern void XtGetValues( Widget /* widget */, @@ -1612,7 +1612,7 @@ extern void XtGetValues( extern void XtVaGetValues( Widget /* widget */, ... -); +) _X_SENTINEL(0); extern void XtSetSubvalues( XtPointer /* base */, @@ -1627,7 +1627,7 @@ extern void XtVaSetSubvalues( XtResourceList /* resources */, Cardinal /* num_resources */, ... -); +) _X_SENTINEL(0); extern void XtGetSubvalues( XtPointer /* base */, @@ -1642,7 +1642,7 @@ extern void XtVaGetSubvalues( XtResourceList /* resources */, Cardinal /* num_resources */, ... -); +) _X_SENTINEL(0); extern void XtGetResourceList( WidgetClass /* widget_class */, diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h index 6cdbc70..d749867 100644 --- a/include/X11/IntrinsicI.h +++ b/include/X11/IntrinsicI.h @@ -231,7 +231,7 @@ extern void _XtGeoTab (int); extern void _XtGeoTrace ( Widget widget, ... -); +) _X_ATTRIBUTE_PRINTF(2,3); #define CALLGEOTAT(f) f -- cgit v1.2.3