Search code examples
ctestinggcctoolchain

Disabling DejaGnu Options


Does anybody know how i can disable flag which written at the source code of the file, without changing source code of this file. Maybe i must change one of .exp files?

I want to disable flag -pthread without changing this source code:

// { dg-do run { target *-*-linux* } }
// { dg-options "-pthread" }
#include <pthread.h>
#include <cxxabi.h>
extern "C" int printf (const char *, ...);
int main()
{
  try
    {
      pthread_exit (0);
    }
  catch (abi::__forced_unwind &)
    {
      printf ("caught forced unwind\n");
      throw;
    }
  catch (...)
    {
      printf ("caught ...\n");
      return 1;
    }
}

Solution

  • I don't think you can, however as -pthread on *-*-linux targets simply expands to -D_REENTRANT and -lpthread maybe you could provide a replacement libpthread and add -L dir to the test flags, so that the system libpthread.so isn't linked to.

    That will of course prevent the program linking if you don't provide a definition of pthread_exit.