This is an archive of the discontinued LLVM Phabricator instance.

[test] fix ScalarEvolution test to allow __func__ with prototype
ClosedPublic

Authored by mgorny on Dec 1 2018, 6:26 AM.

Details

Summary

Fix ScalarEvolution/solve-quadratic.ll test to account for func
output listing the complete function prototype rather than just its
name, as it does on NetBSD.

Example Linux output:

GetQuadraticEquation: addrec coeff bw: 4
GetQuadraticEquation: equation -2x^2 + -2x + -4, coeff bw: 5, multiplied by 2

Example NetBSD output:

llvm::Optional<std::tuple<llvm::APInt, llvm::APInt, llvm::APInt, llvm::APInt, unsigned int> > GetQuadraticEquation(const llvm::SCEVAddRecExpr*): addrec coeff bw: 4
llvm::Optional<std::tuple<llvm::APInt, llvm::APInt, llvm::APInt, llvm::APInt, unsigned int> > GetQuadraticEquation(const llvm::SCEVAddRecExpr*): equation -2x^2 + -2x + -4, coeff bw: 5, multiplied by 2

Diff Detail

Repository
rL LLVM

Event Timeline

mgorny created this revision.Dec 1 2018, 6:26 AM
krytarowski accepted this revision.Dec 1 2018, 6:30 AM

I think that this is GCC specific, not restricted to NetBSD.

This revision is now accepted and ready to land.Dec 1 2018, 6:30 AM

OK, I know a better fix.

https://nxr.netbsd.org/xref/src/sys/sys/cdefs.h#416 contains:

416 /*
417  * C99 defines __func__ predefined identifier, which was made available
418  * in GCC 2.95.
419  */
420 #if !(__STDC_VERSION__ >= 199901L)
421 #if __GNUC_PREREQ__(2, 6)
422 #define	__func__	__PRETTY_FUNCTION__
423 #elif __GNUC_PREREQ__(2, 4)
424 #define	__func__	__FUNCTION__
425 #else
426 #define	__func__	""
427 #endif
428 #endif /* !(__STDC_VERSION__ >= 199901L) */

__func__ is redefiend on NetBSD for C++. func is a part of C++11 and newer.

Please extend the guard in the NetBSD sources to stop redefining it for __cplusplus version 201103L or newer.

This revision was automatically updated to reflect the committed changes.