+2012-07-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ Improve static checking when configured --with-ns.
+ See Samuel Bronson's remarks in
+ <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00146.html>.
+ * configure.in (WARN_CFLAGS): Omit -Wunreachable-code, as it's
+ a no-op with recent GCC and harmful in earlier ones.
+ Omit -Wsync-nand, as it's irrelevant to Emacs and provokes a
+ warning when compiling with ObjC. Always omit
+ -Wunsafe-loop-optimizations, as we don't mind when optimization is
+ being done correctly.
+
2012-07-07 Glenn Morris <rgm@gnu.org>
* configure.in (BROKEN_SA_RESTART): Doc fix.
nw="$nw -Wsign-conversion" # Too many warnings for now
nw="$nw -Woverlength-strings" # Not a problem these days
nw="$nw -Wtraditional-conversion" # Too many warnings for now
+ nw="$nw -Wunreachable-code" # so buggy that it's now silently ignored
nw="$nw -Wpadded" # Our structs are not padded
- nw="$nw -Wredundant-decls" # We regularly (re)declare getenv etc.
+ nw="$nw -Wredundant-decls" # we regularly (re)declare functions
nw="$nw -Wlogical-op" # any use of fwrite provokes this
- nw="$nw -Wformat-nonliteral" # Emacs does this a lot
+ nw="$nw -Wformat-nonliteral" # we do this a lot
nw="$nw -Wvla" # warnings in gettext.h
nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__
nw="$nw -Wswitch-enum" # Too many warnings for now
nw="$nw -Wswitch-default" # Too many warnings for now
- nw="$nw -Wfloat-equal" # e.g., ftoastr.c
- nw="$nw -Winline" # e.g., dispnew.c's inlining of row_equal_p
+ nw="$nw -Wfloat-equal" # warns about high-quality code
+ nw="$nw -Winline" # OK to ignore 'inline'
+ nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
+ nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
# Emacs doesn't care about shadowing; see
# <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
nw="$nw -Wsuggest-attribute=const"
nw="$nw -Wsuggest-attribute=pure"
- # Some loops can't be optimized with -O1,
- # so remove -Wunsafe-loop-optimizations.
- if echo "$CFLAGS" | $EGREP 'O1' 1>/dev/null; then
- nw="$nw -Wunsafe-loop-optimizations"
- fi
-
gl_MANYWARN_ALL_GCC([ws])
gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
for w in $ws; do
+2012-07-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix some minor --with-ns problems found by static checking.
+ * frame.c (Ftool_bar_pixel_width) [!FRAME_TOOLBAR_WIDTH]:
+ (x_set_font) [!HAVE_X_WINDOWS]:
+ * image.c (xpm_load_image) [HAVE_NS]:
+ (x_to_xcolors) [!HAVE_X_WINDOWS && !HAVE_NTGUI]:
+ (x_disable_image) [!HAVE_NS && !HAVE_NTGUI]:
+ Remove unused local.
+ (Fx_parse_geometry) [HAVE_NS]: Don't return garbage.
+ (xpm_load_image) [HAVE_NS && !HAVE_XPM]: Remove unused label.
+ * image.c (x_create_bitmap_from_file) [HAVE_NS]:
+ (xpm_load_image, xpm_load) [HAVE_NS && !HAVE_XPM]:
+ * nsselect.m (symbol_to_nsstring, ns_string_to_pasteboard_internal):
+ * xfaces.c (Fx_load_color_file) [!HAVE_X_WINDOWS]:
+ Fix pointer signedness problem.
+ * xfaces.c (FRAME_X_FONT_TABLE):
+ * xterm.h (FRAME_X_FONT_TABLE): Remove unused, incompatible macros.
+
2012-07-07 Glenn Morris <rgm@gnu.org>
* lread.c (load_path_check): New function, split from init_lread.
used. */)
(Lisp_Object frame)
{
- struct frame *f;
-
if (NILP (frame))
frame = selected_frame;
CHECK_FRAME (frame);
- f = XFRAME (frame);
#ifdef FRAME_TOOLBAR_WIDTH
- if (FRAME_WINDOW_P (f))
- return make_number (FRAME_TOOLBAR_WIDTH (f));
+ if (FRAME_WINDOW_P (XFRAME (frame)))
+ return make_number (FRAME_TOOLBAR_WIDTH (XFRAME (frame)));
#endif
return make_number (0);
}
void
x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
- Lisp_Object font_object, font_param = Qnil;
+ Lisp_Object font_object;
int fontset = -1;
+#ifdef HAVE_X_WINDOWS
+ Lisp_Object font_param = arg;
+#endif
/* Set the frame parameter back to the old value because we may
fail to use ARG as the new parameter value. */
never fail. */
if (STRINGP (arg))
{
- font_param = arg;
fontset = fs_query_fontset (arg, 0);
if (fontset < 0)
{
error ("Unknown fontset: %s", SDATA (XCAR (arg)));
font_object = XCDR (arg);
arg = AREF (font_object, FONT_NAME_INDEX);
+#ifdef HAVE_X_WINDOWS
font_param = Ffont_get (font_object, QCname);
+#endif
}
else if (FONT_OBJECT_P (arg))
{
font_object = arg;
+#ifdef HAVE_X_WINDOWS
font_param = Ffont_get (font_object, QCname);
+#endif
/* This is to store the XLFD font name in the frame parameter for
backward compatibility. We should store the font-object
itself in the future. */
(Lisp_Object string)
{
#ifdef HAVE_NS
- call1 (Qns_parse_geometry, string);
+ return call1 (Qns_parse_geometry, string);
#else
int geometry, x, y;
unsigned int width, height;
dpyinfo->bitmaps[id - 1].depth = 1;
dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap);
dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap);
- strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file));
+ strcpy (dpyinfo->bitmaps[id - 1].file, SSDATA (file));
return id;
#endif
{
if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0)
color_val = Qt;
- else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+ else if (x_defined_color (f, SSDATA (XCDR (specified_color)),
&cdef, 0))
color_val = make_number (cdef.pixel);
}
failure:
image_error ("Invalid XPM file (%s)", img->spec, Qnil);
- error:
x_destroy_x_image (ximg);
x_destroy_x_image (mask_img);
x_clear_image (f, img);
return 0;
}
- contents = slurp_file (SDATA (file), &size);
+ contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
image_error ("Error loading XPM image `%s'", img->spec, Qnil);
p = colors;
for (y = 0; y < img->height; ++y)
{
- XColor *row = p;
-
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
+ XColor *row = p;
for (x = 0; x < img->width; ++x, ++p)
p->pixel = GET_PIXEL (ximg, x, y);
if (rgb_p)
if (n_planes < 2 || cross_disabled_images)
{
#ifndef HAVE_NTGUI
- Display *dpy = FRAME_X_DISPLAY (f);
- GC gc;
-
#ifndef HAVE_NS /* TODO: NS support, however this not needed for toolbars */
#define MaskForeground(f) WHITE_PIX_DEFAULT (f)
- gc = XCreateGC (dpy, img->pixmap, 0, NULL);
+ Display *dpy = FRAME_X_DISPLAY (f);
+ GC gc = XCreateGC (dpy, img->pixmap, 0, NULL);
XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f));
XDrawLine (dpy, img->pixmap, gc, 0, 0,
img->width - 1, img->height - 1);
if (EQ (sym, QPRIMARY)) return NXPrimaryPboard;
if (EQ (sym, QSECONDARY)) return NXSecondaryPboard;
if (EQ (sym, QTEXT)) return NSStringPboardType;
- return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)];
+ return [NSString stringWithUTF8String: SSDATA (XSYMBOL (sym)->xname)];
}
static NSPasteboard *
CHECK_STRING (str);
- utfStr = SDATA (str);
+ utfStr = SSDATA (str);
nsStr = [[NSString alloc] initWithBytesNoCopy: utfStr
length: SBYTES (str)
encoding: NSUTF8StringEncoding
for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
call3 (Fcar (rest), selection, target_symbol, successful_p);
}
-
+
return value;
}
if (EQ (selection, Qt)) selection = QSECONDARY;
pb = ns_symbol_to_pb (selection);
if (pb == nil) return Qnil;
-
+
types = [pb types];
return ([types count] == 0) ? Qnil : Qt;
}
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO
#define x_display_info w32_display_info
-#define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE
#define check_x check_w32
#define GCGraphicsExposures 0
#endif /* WINDOWSNT */
#undef FRAME_X_DISPLAY_INFO
#define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO
#define x_display_info ns_display_info
-#define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE
#define check_x check_ns
#define GCGraphicsExposures 0
#endif /* HAVE_NS */
CHECK_STRING (filename);
abspath = Fexpand_file_name (filename, Qnil);
- fp = fopen (SDATA (abspath), "rt");
+ fp = fopen (SSDATA (abspath), "rt");
if (fp)
{
char buf[512];
/* This is the Colormap which frame F uses. */
#define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap
-/* This is the 'font_info *' which frame F has. */
-#define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table)
-
/* The difference in pixels between the top left corner of the
Emacs window (including possible window manager decorations)
and FRAME_X_WINDOW (f). */