Using the -pedantic flag with gcc uncovered a series of warnings about

non-standard C constructs in the code. This commit fixes them.



git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1682 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
jtsiomb 2014-05-14 18:31:58 +00:00
parent ff6255810d
commit bca59c67ef
3 changed files with 36 additions and 33 deletions

View File

@ -16,13 +16,13 @@ static int sequence_number = 0 ;
int windows[CALLBACKMAKER_N_WINDOWS] = {0};
/* define status vars showing whether given callback has been called for given window */
#define CALLBACK_CALLED_VAR(name) int name##_called[CALLBACKMAKER_N_WINDOWS] = {0};
#define CALLBACK_0V(name) int name##_seq[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_CALLED_VAR(name);
#define CALLBACK_1V(name,field) int name##_##field[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_0V(name);
#define CALLBACK_2V(name,field1,field2) int name##_##field2[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_1V(name,field1);
#define CALLBACK_3V(name,field1,field2,field3) int name##_##field3[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_2V(name,field1,field2);
#define CALLBACK_4V(name,field1,field2,field3,field4) int name##_##field4[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_3V(name,field1,field2,field3);
#define CALLBACK_5V(name,field1,field2,field3,field4,field5) int name##_##field5[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_4V(name,field1,field2,field3,field4);
#define CALLBACK_CALLED_VAR(name) int name##_called[CALLBACKMAKER_N_WINDOWS] = {0}
#define CALLBACK_0V(name) int name##_seq[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_CALLED_VAR(name)
#define CALLBACK_1V(name,field) int name##_##field[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_0V(name)
#define CALLBACK_2V(name,field1,field2) int name##_##field2[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_1V(name,field1)
#define CALLBACK_3V(name,field1,field2,field3) int name##_##field3[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_2V(name,field1,field2)
#define CALLBACK_4V(name,field1,field2,field3,field4) int name##_##field4[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_3V(name,field1,field2,field3)
#define CALLBACK_5V(name,field1,field2,field3,field4,field5) int name##_##field5[CALLBACKMAKER_N_WINDOWS] = {-1}; CALLBACK_4V(name,field1,field2,field3,field4)
CALLBACK_2V(reshape,width,height);
CALLBACK_2V(position,top,left);
CALLBACK_1V(visibility,vis);
@ -39,7 +39,7 @@ CALLBACK_3V(passivemotion,x,y,mod);
CALLBACK_1V(entry,state);
CALLBACK_0V(close);
/* menudestroy is registered on each menu, not a window */
int menudestroy_called = 0 ;
int menudestroy_called = 0;
/* menustatus and menustate are global callbacks, set for all menus at the same time */
int menustatus_called = 0;
int menustate_called = 0;

View File

@ -122,31 +122,31 @@ void FGAPIENTRY glut##a##Func( FGCB##b callback ) \
#define IMPLEMENT_CALLBACK_FUNC(a) IMPLEMENT_CALLBACK_FUNC_2NAME(a,a)
/* Implement all these callback setter functions... */
IMPLEMENT_CALLBACK_FUNC(Position);
IMPLEMENT_CALLBACK_FUNC(Keyboard);
IMPLEMENT_CALLBACK_FUNC(KeyboardUp);
IMPLEMENT_CALLBACK_FUNC(Special);
IMPLEMENT_CALLBACK_FUNC(SpecialUp);
IMPLEMENT_CALLBACK_FUNC(Mouse);
IMPLEMENT_CALLBACK_FUNC(MouseWheel);
IMPLEMENT_CALLBACK_FUNC(Motion);
IMPLEMENT_CALLBACK_FUNC_2NAME(PassiveMotion,Passive);
IMPLEMENT_CALLBACK_FUNC(Entry);
IMPLEMENT_CALLBACK_FUNC(Position)
IMPLEMENT_CALLBACK_FUNC(Keyboard)
IMPLEMENT_CALLBACK_FUNC(KeyboardUp)
IMPLEMENT_CALLBACK_FUNC(Special)
IMPLEMENT_CALLBACK_FUNC(SpecialUp)
IMPLEMENT_CALLBACK_FUNC(Mouse)
IMPLEMENT_CALLBACK_FUNC(MouseWheel)
IMPLEMENT_CALLBACK_FUNC(Motion)
IMPLEMENT_CALLBACK_FUNC_2NAME(PassiveMotion,Passive)
IMPLEMENT_CALLBACK_FUNC(Entry)
/* glutWMCloseFunc is an alias for glutCloseFunc; both set the window's Destroy callback */
IMPLEMENT_CALLBACK_FUNC_2NAME(Close,Destroy);
IMPLEMENT_CALLBACK_FUNC_2NAME(WMClose,Destroy);
IMPLEMENT_CALLBACK_FUNC(OverlayDisplay);
IMPLEMENT_CALLBACK_FUNC(WindowStatus);
IMPLEMENT_CALLBACK_FUNC(ButtonBox);
IMPLEMENT_CALLBACK_FUNC(Dials);
IMPLEMENT_CALLBACK_FUNC(TabletMotion);
IMPLEMENT_CALLBACK_FUNC(TabletButton);
IMPLEMENT_CALLBACK_FUNC(MultiEntry);
IMPLEMENT_CALLBACK_FUNC(MultiButton);
IMPLEMENT_CALLBACK_FUNC(MultiMotion);
IMPLEMENT_CALLBACK_FUNC(MultiPassive);
IMPLEMENT_CALLBACK_FUNC(InitContext);
IMPLEMENT_CALLBACK_FUNC(AppStatus);
IMPLEMENT_CALLBACK_FUNC_2NAME(Close,Destroy)
IMPLEMENT_CALLBACK_FUNC_2NAME(WMClose,Destroy)
IMPLEMENT_CALLBACK_FUNC(OverlayDisplay)
IMPLEMENT_CALLBACK_FUNC(WindowStatus)
IMPLEMENT_CALLBACK_FUNC(ButtonBox)
IMPLEMENT_CALLBACK_FUNC(Dials)
IMPLEMENT_CALLBACK_FUNC(TabletMotion)
IMPLEMENT_CALLBACK_FUNC(TabletButton)
IMPLEMENT_CALLBACK_FUNC(MultiEntry)
IMPLEMENT_CALLBACK_FUNC(MultiButton)
IMPLEMENT_CALLBACK_FUNC(MultiMotion)
IMPLEMENT_CALLBACK_FUNC(MultiPassive)
IMPLEMENT_CALLBACK_FUNC(InitContext)
IMPLEMENT_CALLBACK_FUNC(AppStatus)

View File

@ -155,6 +155,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
else
{
XVisualInfo * visualInfo;
int result;
#ifdef EGL_VERSION_1_0
EGLint vid = 0;
XVisualInfo visualTemplate;
@ -166,13 +167,15 @@ int fgPlatformGlutGet ( GLenum eWhat )
visualTemplate.visualid = vid;
visualInfo = XGetVisualInfo(fgDisplay.pDisplay.Display, VisualIDMask, &visualTemplate, &num_visuals);
#else
{
const GLXFBConfig fbconfig =
fgStructure.CurrentWindow->Window.pContext.FBConfig;
visualInfo =
glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, fbconfig );
}
#endif
const int result = visualInfo->visual->map_entries;
result = visualInfo->visual->map_entries;
XFree(visualInfo);