<commit_before>from __future__ import absolute_import

from confu.tools.toolchains import Toolchain


class UnixToolchain(Toolchain):
    def __init__(self, target):
        super(UnixToolchain, self).__init__(target)
        self.cc = None
        self.cxx = None
        self.ar = None
        self.ranlib = None
        self.strip = None
        self.objcopy = None

        self.cflags = ["-std=gnu99", "-g"]
        self.cxxflags = ["-std=gnu++0x" if self.target == "x86_64-nacl-gnu" else "-std=gnu++11", "-g"]
        self.ldflags = []
        self.optflag = "-O3"
        if self.target.is_glibc:
            self.cflags.append("-pthread")
            self.cxxflags.append("-pthread")
            self.ldflags.append("-pthread")

    def write_variables(self, ninja):
        if self.cc is not None:
            ninja.variable("cc", self.cc)
        if self.cxx is not None:<commit_msg>Use -O2 optimimzation by default<commit_after>from __future__ import absolute_import

from confu.tools.toolchains import Toolchain


class UnixToolchain(Toolchain):
    def __init__(self, target):
        super(UnixToolchain, self).__init__(target)
        self.cc = None
        self.cxx = None
        self.ar = None
        self.ranlib = None
        self.strip = None
        self.objcopy = None

        self.cflags = ["-std=gnu99", "-g"]
        self.cxxflags = ["-std=gnu++0x" if self.target == "x86_64-nacl-gnu" else "-std=gnu++11", "-g"]
        self.ldflags = []
        self.optflag = "-O2"
        if self.target.is_glibc:
            self.cflags.append("-pthread")
            self.cxxflags.append("-pthread")
            self.ldflags.append("-pthread")

    def write_variables(self, ninja):
        if self.cc is not None:
            ninja.variable("cc", self.cc)
        if self.cxx is not None:
{'fraction_non_alphanumeric': 0.13019390581717452, 'fraction_numerical': 0.011634349030470914, 'mean_word_length': 2.168421052631579, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1659957', 'n_tokens_mistral': 600, 'n_tokens_neox': 587, 'n_words': 125}