tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lingering USE_LANGUAGES documentation



"David H. Gutteridge" <david%gutteridge.ca@localhost> writes:

> On Sat, 09 Dec 2023 at 11:10:08 -0500, Greg Troxel wrote:
>> in mk/compiler.mk:
>> #       If the package assumes the compiler defaults to a specific
>> #       language version, the USE_LANGUAGES variable can also be used
>> #       to force the inclusion of flags such as -std=c++11. In this
>> case,
>> #       USE_CC_FEATURES/USE_CXX_FEATURES should also be set.
>> My impression is that this is at best deprecated, and the proper
>> approach is FORCE_CXX_STD (which is documented just below the above).
>> And therefore, we should
>>  remove that paragraph
>>  from the list of valid values, drop the specific language families
>>  like c++11
>> If that's not right, then I would like to understand why, so we can
>> explain under what circumstances USE_LANGUAGES of e.g. c++11 is
>> correct.
>
> I'm pressed for time at the moment, but would mention that the FORCE_*
> variables are defined for compilers that accept "GCC style" arguments;
> for those that don't, this would (presently) have no effect.

> An example evidently would be PCC, which has
>
> # Turn on C99 support if required
> #.if !empty(USE_LANGUAGES:Mc99)
> #_WRAP_EXTRA_ARGS.CC+=	-xc99
> #.endif
>
> in mk/compiler/pcc.mk. That could of course be adjusted.

Indeed it should be.  There appears to be a scheme to expose these flags
in variables so they can be used more generically, but I can't find
where.   The variable _C_STD_FLAG.c99 is used without being checked, but
I guess if it's null nothing happens.

  _C_VERSION_REQD=                                                                                                          |
  .for _version_ in ${_C_STD_VERSIONS}                                                                                      |
  .  if empty(_C_VERSION_REQD) && !empty(USE_LANGUAGES:M${_version_})                                                       |
  _C_VERSION_REQD=        ${_version_}                                                                                      |
  _WRAP_EXTRA_ARGS.CC+=   ${_C_STD_FLAG.${_C_VERSION_REQD}}                                                                 |
  CWRAPPERS_PREPEND.cc+=  ${_C_STD_FLAG.${_C_VERSION_REQD}}                                                                 |
  .  endif                                                                                                                  |
  .endfor                                                                                                                   |


Home | Main Index | Thread Index | Old Index