Пример #1
0
    def collect(self):
        expect_out_file = False
        for w in self.cmd:
            # TODO: Deal with -E... Do nothing?

            # Collect file(s) being compiled.
            if w.endswith(".c"):
                self.sources.append(w)
                continue

            # Identify C version, if specified.
            if w.startswith("-std="):
                self.c_version = w[5:]
            if w == "-ansi":
                self.c_version = "c90"

            # Pedantic compilation.
            if w == "-pedantic-errors":
                self.pedantic = True

            # Keep track of output file, if specified.
            if expect_out_file:
                self.out_file_name = w
                expect_out_file = False

            if w == "-o":
                expect_out_file = True

        # Temporary
        if self.c_version != 'c99':
            DiagnosticReporter.warning(C_VERSION_NOT_SUPPORTED)
            self.c_version = 'c99'
Пример #2
0
    def collect(self):
        expect_out_file = False
        for v in self.cmd:
            # TODO: Deal vith -E... Do nothing?

            if v.startswith("-std="):
                self.c_version = v[5:]
            if v == "-ansi":
                self.c_version = "c90"

            if v.endswith('.c'):
                self.c_files.append(v)
                continue

            if v.startswith('-D'):
                self.D_lst.append(v[2:].strip())
                continue

            if v.startswith('-U'):
                self.U_lst.append(v[2:].strip())
                continue

            if v.startswith('-I'):
                self.I_lst.append(v[2:].strip())
                continue

            if v == "-pedantic-errors":
                self.pedantic = True

            # Keep track of output file, if specified.
            if expect_out_file:
                self.out_file_name = v
                expect_out_file = False
            if v == "-o":
                expect_out_file = True

        # Temporary
        if self.c_version != 'c99':
            DiagnosticReporter.warning(C_VERSION_NOT_SUPPORTED)
            self.c_version = 'c99'

        return self