michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * A test to see if the macros PR_DELETE and PR_FREEIF are michael@0: * properly defined. (See Bugzilla bug #39110.) michael@0: */ michael@0: michael@0: #include "nspr.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: static void Noop(void) { } michael@0: michael@0: static void Fail(void) michael@0: { michael@0: printf("FAIL\n"); michael@0: exit(1); michael@0: } michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: int foo = 1; michael@0: char *ptr = NULL; michael@0: michael@0: /* this fails to compile with the old definition of PR_DELETE */ michael@0: if (foo) michael@0: PR_DELETE(ptr); michael@0: else michael@0: Noop(); michael@0: michael@0: /* this nests incorrectly with the old definition of PR_FREEIF */ michael@0: if (foo) michael@0: PR_FREEIF(ptr); michael@0: else michael@0: Fail(); michael@0: michael@0: printf("PASS\n"); michael@0: return 0; michael@0: }