How to enable c11 on later versions of gcc?

后端 未结 4 592
轮回少年
轮回少年 2020-12-09 14:29

I currently use gcc 4.6.3. My understanding is that gcc by default uses the gnu89 standard and I would like to enable C11, the latest

4条回答
  •  旧巷少年郎
    2020-12-09 15:29

    Inside a .spec file :

    %define gcc_ver %(if [[ $(gcc -dumpversion) > 4.7 ]]; then echo 1; else echo 0; fi)
    # Do we use c11 ?
    %if 0%{?gcc_ver} < 1
      %global std_c11 0
    %else
      %global std_c11 1
    %endif
    
    # if the configure of the package supports it add :
    %if %{std_c11}
      --enable-cxx11 \
    %endif
    

提交回复
热议问题