add C standard flags to compiler classes (#11618)
* add c99_flag, c11_flag to compiler class * implement c99_flag, c11_flag for gcc * implement c99_flag, c11_flag for arm * implement c99_flag for cce * implement c99_flag, c11_flag for clang * implement c99_flag, c11_flag for intel * implement c99_flag, c11_flag for xl
This commit is contained in:
		@@ -195,6 +195,24 @@ def cxx17_flag(self):
 | 
			
		||||
                                      "the C++17 standard",
 | 
			
		||||
                                      "cxx17_flag")
 | 
			
		||||
 | 
			
		||||
    # This property should be overridden in the compiler subclass if
 | 
			
		||||
    # C99 is supported by that compiler
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        # If it is not overridden, assume it is not supported and warn the user
 | 
			
		||||
        raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                      "the C99 standard",
 | 
			
		||||
                                      "c99_flag")
 | 
			
		||||
 | 
			
		||||
    # This property should be overridden in the compiler subclass if
 | 
			
		||||
    # C11 is supported by that compiler
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        # If it is not overridden, assume it is not supported and warn the user
 | 
			
		||||
        raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                      "the C11 standard",
 | 
			
		||||
                                      "c11_flag")
 | 
			
		||||
 | 
			
		||||
    #
 | 
			
		||||
    # Compiler classes have methods for querying the version of
 | 
			
		||||
    # specific compiler executables.  This is used when discovering compilers.
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,14 @@ def cxx14_flag(self):
 | 
			
		||||
    def cxx17_flag(self):
 | 
			
		||||
        return "-std=c++1z"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        return "-std=c99"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        return "-std=c11"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-fPIC"
 | 
			
		||||
 
 | 
			
		||||
@@ -42,6 +42,10 @@ def openmp_flag(self):
 | 
			
		||||
    def cxx11_flag(self):
 | 
			
		||||
        return "-h std=c++11"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        return "-h c99"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-h PIC"
 | 
			
		||||
 
 | 
			
		||||
@@ -157,6 +157,20 @@ def cxx17_flag(self):
 | 
			
		||||
            else:
 | 
			
		||||
                return "-std=c++17"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        return '-std=c99'
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        if self.version < ver('6.1.0'):
 | 
			
		||||
            raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                          "the C11 standard",
 | 
			
		||||
                                          "c11_flag",
 | 
			
		||||
                                          "< 3.3")
 | 
			
		||||
        else:
 | 
			
		||||
            return "-std=c11"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-fPIC"
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,24 @@ def cxx17_flag(self):
 | 
			
		||||
        else:
 | 
			
		||||
            return "-std=c++17"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        if self.version < ver('4.5'):
 | 
			
		||||
            raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                          "the C99 standard",
 | 
			
		||||
                                          "c99_flag",
 | 
			
		||||
                                          "< 4.5")
 | 
			
		||||
        return "-std=c99"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        if self.version < ver('4.7'):
 | 
			
		||||
            raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                          "the C11 standard",
 | 
			
		||||
                                          "c11_flag",
 | 
			
		||||
                                          "< 4.7")
 | 
			
		||||
        return "-std=c11"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-fPIC"
 | 
			
		||||
 
 | 
			
		||||
@@ -65,6 +65,26 @@ def cxx14_flag(self):
 | 
			
		||||
        else:
 | 
			
		||||
            return "-std=c++14"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        if self.version < ver('12'):
 | 
			
		||||
            raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                          "the C99 standard",
 | 
			
		||||
                                          "c99_flag",
 | 
			
		||||
                                          "< 12")
 | 
			
		||||
        else:
 | 
			
		||||
            return "-std=c99"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        if self.version < ver('16'):
 | 
			
		||||
            raise UnsupportedCompilerFlag(self,
 | 
			
		||||
                                          "the C11 standard",
 | 
			
		||||
                                          "c11_flag",
 | 
			
		||||
                                          "< 16")
 | 
			
		||||
        else:
 | 
			
		||||
            return "-std=c1x"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-fPIC"
 | 
			
		||||
 
 | 
			
		||||
@@ -43,6 +43,14 @@ def cxx11_flag(self):
 | 
			
		||||
        else:
 | 
			
		||||
            return "-qlanglvl=extended0x"
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c99_flag(self):
 | 
			
		||||
        return '-std=c99'
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def c11_flag(self):
 | 
			
		||||
        return '-std=c11'
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def pic_flag(self):
 | 
			
		||||
        return "-qpic"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user