lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 28 May 2008 20:04:22 -0700 From: Joe Perches <joe@...ches.com> To: Johannes Weiner <hannes@...urebad.de> Cc: James Kosin <jkosin@...a.intcomgrp.com>, linux-kernel@...r.kernel.org Subject: Re: optimizing out inline functions On Thu, 2008-05-29 at 05:27 +0200, Johannes Weiner wrote: > James Kosin <jkosin@...a.intcomgrp.com> writes: > >> But we do not have KCONFIG_DEBUG_SOMETHING available > >> so the second best is to use an empty function > >> to keep the typechecking in place. > >> IIRC gcc optimize both away. > > Another way would be to have: > > static inline void some_debug_function(var1) > > { > > #ifdef KCONFIG_DEBUG_SOMETHING > > something = var1; > > printk(some debug text); > > #endif > > } A potential issue is a possible unnecessary call of any function used as an argument to some_debug_function. int unnecessary_debug_test(void) { int foo; [] return foo; } static inline void some_debug_function(int bar) { } some_debug_function(unnecessary_debug_test()) unnecessary_debug_test will still get called Macro wrappers/statement expressions can be used to avoid the function call. see kernel.h/pr_debug for an example. #ifdef DEBUG /* If you are writing a driver, please use dev_dbg instead */ #define pr_debug(fmt, arg...) \ printk(KERN_DEBUG fmt, ##arg) #else #define pr_debug(fmt, arg...) \ ({ if (0) printk(KERN_DEBUG fmt, ##arg); 0; }) #endif -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists