use _GL_ATTRIBUTE_CONST and _GL_ATTRIBUTE_PURE
[pspp] / lib / basename-lgpl.c
index 0a4cb8c8398fc844e8f95f888cb80e140fd5cdae..f2738cd407451f646eea381e35e18bb15e409fa5 100644 (file)
@@ -1,7 +1,7 @@
 /* basename.c -- return the last element in a file name
 
-   Copyright (C) 1990, 1998-2001, 2003-2006, 2009 Free Software Foundation,
-   Inc.
+   Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2011 Free Software
+   Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <string.h>
 
+/* The attribute __pure__ was added in gcc 2.96.  */
+#undef _GL_ATTRIBUTE_PURE
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
 /* Return the address of the last file name component of NAME.  If
    NAME has no relative file name components because it is a file
    system root, return the empty string.  */
 
-char *
+char * _GL_ATTRIBUTE_PURE
 last_component (char const *name)
 {
   char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);