emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

byte-compiler warning


From: Bogolisk
Subject: byte-compiler warning
Date: Mon, 5 May 2014 11:23:17 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

========================= 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 via email to

[Prev in Thread] Current Thread [Next in Thread]