all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* byte-compiler warning
@ 2014-05-05 11:23 Bogolisk
  0 siblings, 0 replies; only message in thread
From: Bogolisk @ 2014-05-05 11:23 UTC (permalink / raw)
  To: emacs-devel

========================= blah.c starts ================================
;; -*- lexical-binding: t -*-

(defun func-with-4-args (a b c d)
  (+ a b c d))

(defsubst inline-func-with-4-args (a b c d)
  (+ a b c d))

(defun func-with-2-args (x y)
  (+ (inline-func-with-4-args x y)
     (func-with-4-args x y)))
========================= blah.c ends ================================

When compiling this file in emacs -Q (pretest),
The compiler only complains about wrong number of args for the non-inline 
called function. The compiler doesn't seem to care about wrong number of 
args for inline functions.

Compiling file /tmp/blah.c at Mon May  5 07:15:32 2014

In func-with-2-args:
blah.c:11:7:Warning: func-with-4-args called with 2 arguments, but requires 
4


Change func-with-4-args to defsubst and the compiler no longer warns about
wrong number of args. The weird thing is, revert func-with-4-args to defun
will no bring back the warning. The compiler somehow remembers that
func-with-4-args used to be a defsubst and just ignores its number of args.

--
Bogolisk






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-05 11:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-05 11:23 byte-compiler warning Bogolisk

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.