как найти источник некоторых макросов
Существует много мест для определения макроса. Когда макрос определен нами в нашем собственном проекте, легко найти для него позицию определения. Но когда я пытаюсь изучить какой-то известный проект с открытым исходным кодом, меня часто мучает вопрос: где найти источник макросов, если я не могу получить его определение, я не понимаю некоторые из них (например, некоторые из них можно догадаться по их названию). например, какое-то утверждение от apache:
#if defined(__osf__) && defined(__alpha),
#elif defined(__NSIG)
Что касается моих знаний, я знаю, что есть несколько возможных исходных мест для макроса:
from this project itself,in some source file(this is the easiest,because we can find it by some tool) from some header file of some 3rd lib ,we can grep it from c/c++ standard header file(where are they in linux?) from the os (where are they in linux?) automatically generated by the configure tool(it is bitter,i have no idea) from the compiler tool like gcc/g++,or in the makefile we can define some macroУ меня есть вопрос, чтобы проконсультироваться:
how to differentiate them between os defined and gcc/g++ defined and configure tool generated macros? do they have some characteristic respectively? how to find the source of those defined by os or by standard C or compiler? e.g.,usinggrep
or find
utilities
what does it mean if one macro such as __strange___
can not be find by combing the whole machine (cd /;grep __strange___ -r
)?
Спасибо за то, что рассказали о принципе и методе, чтобы отличить их и найти их источник!