This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Profile mode maintenance patch


On 23/09/2014 13:27, Jonathan Wakely wrote:

Yes, OK for trunk - thanks very much.

Hi

There was in fact one last test failing, ext/profile/mh.cc, a profile mode specific test. It must have been failing for quite a while since malloc hooks has been deprecated. It is normally testing the profile mode protection against recursion if memory allocation functions are redefined. It was based on malloc but we use in fact new operator. So I rewrite the test using new/delete operators.

This new test version is attached, I removed those 2 lines at the beginning:

// { dg-do compile { target *-*-linux* *-*-gnu* } }
// { dg-xfail-if "" { uclibc } { "*" } { "" } }

I think that this test can now be executed and see no reason why it should fail with uclibc. Do you confirm ?

I attached the full patch again. I also remove useless virtual destructor or methods, no need for polymorphism.

François

Attachment: profile.patch.bz2
Description: application/bzip

// -*- C++ -*-

// Copyright (C) 2006-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3.  If not see
// <http://www.gnu.org/licenses/>.

// { dg-require-profile-mode "" }

#include <vector>

using std::vector;

void* operator new(std::size_t size) throw(std::bad_alloc)
{
  void* p = std::malloc(size);
  if (!p)
    throw std::bad_alloc();
  return p;
}

void* operator new (std::size_t size, const std::nothrow_t&) throw()
{
  // With _GLIBCXX_PROFILE, the instrumentation of the vector constructor
  // will call back into this new operator.
  vector<int> v;
  return std::malloc(size);
}

void operator delete(void* p) throw()
{
  if (p)
    std::free(p);
}

int
main() 
{
  vector<int> v;
  return 0;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]