all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bogolisk <bogolisk@gmail.com>
To: emacs-devel@gnu.org
Subject: byte-compiler warning
Date: Mon, 5 May 2014 11:23:17 +0000 (UTC)	[thread overview]
Message-ID: <loom.20140505T131553-340@post.gmane.org> (raw)

========================= 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






                 reply	other threads:[~2014-05-05 11:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20140505T131553-340@post.gmane.org \
    --to=bogolisk@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.