linux "Undefined reference to macro when !BLK_CGROUP Macro CFQ_WEIGHT_DEFAULT is conditionally defined in blk-cgroup.h, only when BLK_CGROUP is enabled. This macro is referenced in block/cfq-iosched.c (which #include blk-cgroup.h) in a context where the presence of BLK_CGROUP is not guaranteed. Thus, if BLK_CGROUP is disabled, the compiler cannot find any definition for CFQ_WEIGHT_DEFAULT."

Bug fixed by commit f48ec1d7885
Type UndeclaredIdentifier
Config "IOSCHED_CFQ && !BLK_CGROUP" (2nd degree)
Fix-in mapping
Location block/
#ifdef CONFIG_BLK_CGROUP
#define CFQ_WEIGHT_DEFAULT	500
#endif

#ifdef CONFIG_IOSCHED_CFQ
static long cfq_scale_slice()
{
  long d = 1;
  d = d * CFQ_WEIGHT_DEFAULT; // ERROR
  return d;
}
#endif


int main()
{
#ifdef CONFIG_IOSCHED_CFQ
  cfq_scale_slice();
#endif
  return 0;
}

diff --git a/simple/f48ec1d.c b/simple/f48ec1d.c
--- a/simple/f48ec1d.c
+++ b/simple/f48ec1d.c
@@ -1,7 +1,5 @@
 
-#ifdef CONFIG_BLK_CGROUP
 #define CFQ_WEIGHT_DEFAULT	500
-#endif
 
 #ifdef CONFIG_IOSCHED_CFQ
 static long cfq_scale_slice()
#ifdef CONFIG_BLK_CGROUP
#define CFQ_WEIGHT_DEFAULT	500
#endif

int main()
{
#ifdef CONFIG_IOSCHED_CFQ
//  cfq_scale_slice();
  long d = 1;
  d = d * CFQ_WEIGHT_DEFAULT; // ERROR
#endif
  return 0;
}

. block/cfq-iosched.c:841: d = d * CFQ_WEIGHT_DEFAULT;