1 /* PR opt/6516 */ 2 /* On x86, something about the structure of this function prevented 3 cross-jumping from combining the three arms of the switch statement 4 until the last moment. After which we did not delete dead code, 5 which left a reference to the deleted ADDR_VEC. */ 6 7 /* { dg-do compile } */ 8 /* { dg-options "-O2 -frename-registers -fpic" } */ 9 10 typedef unsigned long XID; 11 typedef XID Window; 12 typedef void Display; 13 typedef unsigned long Time; 14 15 typedef struct { 16 int type; 17 unsigned long serial; 18 int send_event; 19 Display *display; 20 Window window; 21 Window root; 22 Window subwindow; 23 Time time; 24 int x, y; 25 int x_root, y_root; 26 unsigned int state; 27 unsigned int button; 28 int same_screen; 29 } XButtonEvent; 30 typedef struct { 31 int type; 32 unsigned long serial; 33 int send_event; 34 Display *display; 35 Window window; 36 Window root; 37 Window subwindow; 38 Time time; 39 int x, y; 40 int x_root, y_root; 41 unsigned int state; 42 char is_hint; 43 int same_screen; 44 } XMotionEvent; 45 typedef struct { 46 int type; 47 unsigned long serial; 48 int send_event; 49 Display *display; 50 Window window; 51 Window root; 52 Window subwindow; 53 Time time; 54 int x, y; 55 int x_root, y_root; 56 int mode; 57 int detail; 58 int same_screen; 59 int focus; 60 unsigned int state; 61 } XCrossingEvent; 62 typedef union _XEvent { 63 int type; 64 XButtonEvent xbutton; 65 XMotionEvent xmotion; 66 XCrossingEvent xcrossing; 67 } XEvent; 68 69 typedef struct { 70 int width, height; 71 Display *display; 72 } Screen; 73 typedef struct _CorePart { 74 Screen *screen; 75 } CorePart; 76 typedef struct _WidgetRec { 77 CorePart core; 78 } WidgetRec; 79 typedef struct _WidgetRec *Widget; 80 81 typedef struct _SmeRec *SmeObject; 82 typedef struct _SimpleMenuPart { 83 SmeObject entry_set; 84 } SimpleMenuPart; 85 typedef struct _SimpleMenuRec { 86 SimpleMenuPart simple_menu; 87 } SimpleMenuRec; 88 typedef struct _SimpleMenuRec* SimpleMenuWidget; 89 90 typedef short Position; 91 typedef unsigned short Dimension; 92 typedef char Boolean; 93 94 typedef struct _RectObjPart { 95 Position x, y; 96 Dimension width, height; 97 Dimension border_width; 98 Boolean managed; 99 Boolean sensitive; 100 Boolean ancestor_sensitive; 101 }RectObjPart; 102 typedef struct _RectObjRec { 103 RectObjPart rectangle; 104 } RectObjRec; 105 typedef struct _RectObjRec *RectObj; 106 107 SmeObject DoGetEventEntry(); 108 109 SmeObject 110 GetEventEntry(Widget w, XEvent *event) 111 { 112 int x_loc, y_loc, x_root; 113 SimpleMenuWidget smw = (SimpleMenuWidget)w; 114 SmeObject entry; 115 int warp, move; 116 switch (event->type) { 117 case 6: 118 x_loc = event->xmotion.x; 119 y_loc = event->xmotion.y; 120 x_root = event->xmotion.x_root; 121 break; 122 case 7: 123 case 8: 124 x_loc = event->xcrossing.x; 125 y_loc = event->xcrossing.y; 126 x_root = event->xcrossing.x_root; 127 break; 128 case 4: 129 case 5: 130 x_loc = event->xbutton.x; 131 y_loc = event->xbutton.y; 132 x_root = event->xbutton.x_root; 133 break; 134 default: 135 XtAppError(XtWidgetToApplicationContext(w), 136 "Unknown event type in GetEventEntry()."); 137 return (((void *)0)); 138 } 139 if (x_loc < 0 || x_loc >= (((RectObj)smw)->rectangle.width) || 140 y_loc < 0 || y_loc >= (((RectObj)smw)->rectangle.height)) 141 return (((void *)0)); 142 if (x_root == ((((w)->core.screen))->width) - 1 && 143 (((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width)) > x_root) { 144 warp = -8; 145 if (smw->simple_menu.entry_set) { 146 entry = DoGetEventEntry(w, 147 (((RectObj)smw->simple_menu.entry_set)->rectangle.x) 148 + (((RectObj)smw->simple_menu.entry_set)->rectangle.width) + 1, 149 y_loc); 150 Unhighlight(w, event, ((void *)0), ((void *)0)); 151 if (entry) { 152 warp = -(int)(((RectObj)entry)->rectangle.width) >> 1; 153 move = x_loc - (((RectObj)entry)->rectangle.width) - (((RectObj)entry)->rectangle.x) + (((RectObj)w)->rectangle.border_width); 154 } 155 else { 156 warp = 0; 157 move = ((((w)->core.screen))->width) - 158 ((((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width) << 1)); 159 } 160 } 161 else { 162 warp = 0; 163 move = ((((w)->core.screen))->width) - 164 ((((RectObj)w)->rectangle.x) + (((RectObj)w)->rectangle.width) + ((((RectObj)w)->rectangle.border_width) << 1)); 165 } 166 } 167 else if (x_root == 0 && (((RectObj)w)->rectangle.x) < 0) { 168 warp = 8; 169 if (smw->simple_menu.entry_set) { 170 entry = DoGetEventEntry(w, (((RectObj)smw->simple_menu.entry_set)->rectangle.x) - 1, 171 y_loc); 172 Unhighlight(w, event, ((void *)0), ((void *)0)); 173 if (entry) { 174 warp = (((RectObj)entry)->rectangle.width) >> 1; 175 move = x_loc - (((RectObj)entry)->rectangle.x); 176 } 177 else 178 move = x_loc + (((RectObj)w)->rectangle.border_width); 179 } 180 else 181 move = x_loc + (((RectObj)w)->rectangle.border_width); 182 } 183 else 184 move = warp = 0; 185 if (move) 186 XtMoveWidget(w, (((RectObj)w)->rectangle.x) + move, (((RectObj)w)->rectangle.y)); 187 if (warp) 188 XWarpPointer((((w)->core.screen)->display), 0L, 0L, 0, 0, 0, 0, warp, 0); 189 return (DoGetEventEntry(w, x_loc, y_loc)); 190 } 191