On Fri, 2009-08-07 at 15:48 +0200, Manuel López-Ibáñez wrote:
> Janis, it would be extremely useful to have dg-options that are only
> enabled for certain languages, so I can do
> 
> /* { dg-options "-std=c99" { dg-require-effective-target c } } */
> /* { dg-options "" { dg-require-effective-target c++ } } */
> 
> Would this be hard to implement? Any ideas?

This seems to work fine (added to target-supports.exp), except that
you'd use them in your example as just "c" and "c++".

# Return 1 if the language for the compiler under test is C.

proc check_effective_target_c { } {
  global tool
  if [string match $tool "gcc"] {
    return 1
  }
  return 0
}

# Return 1 if the language for the compiler under test is C++.

proc check_effective_target_c++ { } {
  global tool
  if [string match $tool "g++"] {
    return 1
  }
  return 0
}

Reply via email to