Инструмент для предоставления только созданного исходного кода Linux

Принятие ни одних из имен файлов содержит символы новой строки:

find "$PWD" -name __openerp__.py  | awk -F/ -vOFS=/ 'NF-=2' | sort -u
2
25.10.2014, 16:04
1 ответ

Конфигурация ядра Linux в конечном итоге определяет, что такое директивы препроцессора для компилятора Си. Вывод из препроцессированных исходников должен быть близок к тому, что вы ищете, хотя может быть и мертвый код, оптимизированный компилятором.

Компилятору gcc можно сказать, чтобы он генерировал препроцессированный вывод в stdout, используя -E (а затем остановиться):

  -E  Stop after the preprocessing stage; do not run the compiler
      proper.  The output is in the form of preprocessed source code,
      which is sent to the standard output.

Для всего кернела, возможно, будет проще включить флаг компилятора --save-temps:

   -save-temps
   -save-temps=cwd
       Store the usual "temporary" intermediate files permanently; place
       them in the current directory and name them based on the source
       file.  Thus, compiling foo.c with -c -save-temps would produce
       files foo.i and foo.s, as well as foo.o.  This creates a
       preprocessed foo.i output file even though the compiler now
       normally uses an integrated preprocessor.

       When used in combination with the -x command line option,
       -save-temps is sensible enough to avoid over writing an input
       source file with the same extension as an intermediate file.  The
       corresponding intermediate file may be obtained by renaming the
       source file before using -save-temps.
3
27.01.2020, 22:05

Теги

Похожие вопросы