http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54054

             Bug #: 54054
           Summary: merged compilation
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: wbr...@gmail.com


Using command
g++-4.7.1 -O3 -march=core2 -v -o test func.cpp main.cpp
GCC compiles files separately with
cc1plus func.cpp
cc1plus main.cpp

GCC could merge these files and compile only file merged.cpp

-------func.cpp---------
#include "func.h"
#include <stdlib.h>

long int func() {
        return random();
}

-------main.cpp--------
#include "func.h"
#include <stdlib.h>

int main() {
        return func();
}

-----merged.cpp-------
#include "func.h"
#include <stdlib.h>

long int func() {
        return random();
}

int main() {
        return func();
}

Reply via email to