combining c-code files into one c-code file

Harald Gustafsson <harald.gustafsson@gmail.com>
Tue, 3 Apr 2012 06:23:24 -0700 (PDT)

          From comp.compilers

Related articles
combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-03)
Re: combining c-code files into one c-code file cameron.mcinally@nyu.edu (Cameron McInally) (2012-04-04)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-04)
Re: combining c-code files into one c-code file gene.ressler@gmail.com (Gene) (2012-04-09)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-18)
| List of all articles for this month |

From: Harald Gustafsson <harald.gustafsson@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 3 Apr 2012 06:23:24 -0700 (PDT)
Organization: Compilers Central
Keywords: C, tools, question
Posted-Date: 04 Apr 2012 10:41:11 EDT

I'm trying to convert libx264 to Android's renderscript as an exercise in how
much work it is to port a bit larger project into renderscript. One of the
pains with renderscript is that the complete executable needs to be declared
within the same file scope (can't easily access functions or constants in
other files) and functions and global variables needs to be declared static to
not automatically get a java interface. Renderscript is C99 compliant.


I started to just include all the c-code files into one renderscript-file and
compile that. Which would had worked quite easily if not libx264 itself had
also included c-files with different pre-processing macro definitions, hence
some functions exist twice with different content and some are redeclared
identical. I could of course handle this manually with many days of work, but
it would be easier with a tool.


I'm asking if anyone knows of a tool that can take a list of c-files and
pre-process/merge that into one c-file, managing redeclarations, conflicting
declarations, declaration order, etc. The readability of the output is less
important but prefers as human readable as possible.


An alternative is to have one file scope but separate each included c-file
into its own namespace, does C99 have any such support?


Regards,
    Harald


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.