cmake HAVE_UNDEFINED_BEHAVIOR_SANITIZER examples

hkrn/nanoem cmake/FindUBSan.cmake :67

check_cxx_source_runs(
"
#include <cstdio>
#include <cstdlib>
#include <iostream>

class BarB
{
    public:
        float y;
        /* Include something that uses a virtual function. The symbols
           that are broken on current OS X libc++ involve this */
        virtual int arst(int o)
        {
            return 4 + o;
        }
    };

/* Just include something that ubsan will need to check */
int main(int argc, const char* argv[])
{
    BarB* b = new BarB();
    if (argc > 1)
    {
        fputs(argv[atoi(argv[1])], stdout);
        std::cout << b->arst(atoi(argv[1]));
    }

    delete b;
    return 0;
}
"
  HAVE_UNDEFINED_BEHAVIOR_SANITIZER)

hkrn/nanoem dependencies/nanodxm/cmake/FindUBSan.cmake :67

check_cxx_source_runs(
"
#include <cstdio>
#include <cstdlib>
#include <iostream>

class BarB
{
    public:
        float y;
        /* Include something that uses a virtual function. The symbols
           that are broken on current OS X libc++ involve this */
        virtual int arst(int o)
        {
            return 4 + o;
        }
    };

/* Just include something that ubsan will need to check */
int main(int argc, const char* argv[])
{
    BarB* b = new BarB();
    if (argc > 1)
    {
        fputs(argv[atoi(argv[1])], stdout);
        std::cout << b->arst(atoi(argv[1]));
    }

    delete b;
    return 0;
}
"
  HAVE_UNDEFINED_BEHAVIOR_SANITIZER)

steineggerlab/foldcomp cmake/FindUBSan.cmake :64

check_cxx_source_runs(
"
#include <cstdio>
#include <cstdlib>
#include <iostream>

class BarB
{
    public:
        float y;
        /* Include something that uses a virtual function. The symbols
           that are broken on current OS X libc++ involve this */
        virtual int arst(int o)
        {
            return 4 + o;
        }
    };

/* Just include something that ubsan will need to check */
int main(int argc, const char* argv[])
{
    BarB* b = new BarB();
    if (argc > 1)
    {
        fputs(argv[atoi(argv[1])], stdout);
        std::cout << b->arst(atoi(argv[1]));
    }

    delete b;
    return 0;
}
"
  HAVE_UNDEFINED_BEHAVIOR_SANITIZER)

maidsafe-archive/MaidSafe cmake_modules/find_ubsan.cmake :69

check_cxx_source_runs(
"
#include <cstdio>
#include <cstdlib>
#include <iostream>

class BarB
{
    public:
        float y;
        /* Include something that uses a virtual function. The symbols
           that are broken on current OS X libc++ involve this */
        virtual int arst(int o)
        {
            return 4 + o;
        }
    };

/* Just include something that ubsan will need to check */
int main(int argc, const char* argv[])
{
    BarB* b = new BarB();
    if (argc > 1)
    {
        fputs(argv[atoi(argv[1])], stdout);
        std::cout << b->arst(atoi(argv[1]));
    }

    delete b;
    return 0;
}
"
  HAVE_UNDEFINED_BEHAVIOR_SANITIZER)

maidsafe-archive/MaidSafe cmake_modules/standard_flags.cmake :108

elseif(HAVE_UNDEFINED_BEHAVIOR_SANITIZER AND HAVE_FLAG_SANITIZE_BLACKLIST)

soedinglab/hh-suite cmake/FindUBSan.cmake :64

check_cxx_source_runs(
"
#include <cstdio>
#include <cstdlib>
#include <iostream>

class BarB
{
    public:
        float y;
        /* Include something that uses a virtual function. The symbols
           that are broken on current OS X libc++ involve this */
        virtual int arst(int o)
        {
            return 4 + o;
        }
    };

/* Just include something that ubsan will need to check */
int main(int argc, const char* argv[])
{
    BarB* b = new BarB();
    if (argc > 1)
    {
        fputs(argv[atoi(argv[1])], stdout);
        std::cout << b->arst(atoi(argv[1]));
    }

    delete b;
    return 0;
}
"
  HAVE_UNDEFINED_BEHAVIOR_SANITIZER)