Skip to contentSkip to conversation

Add _DRM_HIDDEN macro

PATCH In review Julien Cristau 2 participants 6 messages Jun 10, 2010 – Jun 12, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Add _DRM_HIDDEN macro

Introduce a new internal header since that doesn't seem to exist yet. Or maybe I should rename xf86atomic.h instead.

---
 xf86drm-internals.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
 create mode 100644 xf86drm-internals.h
xf86drm-internals.h new file +12 -0
new file mode 100644
index 0000000..bf5ff51
@@ -0,0 +1,12 @@
+#ifndef XF86DRM_INTERNALS_H
+#define XF86DRM_INTERNALS_H
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+# define _DRM_HIDDEN      __attribute__((visibility("hidden")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _DRM_HIDDEN      __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_HIDDEN
+#endif /* GNUC >= 4 */
+
+#endif
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/3 libkms: don't export internal functions

---
 libkms/internal.h |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
libkms/internal.h +5 -4
index 63122d1..efb781a 100644
@@ -30,6 +30,7 @@
 #define INTERNAL_H_
 
 #include "libkms.h"
+#include "xf86drm-internals.h"
 
 struct kms_driver
 {
@@ -62,12 +63,12 @@ struct kms_bo
 	unsigned handle;
 };
 
-int linux_create(int fd, struct kms_driver **out);
+_DRM_HIDDEN int linux_create(int fd, struct kms_driver **out);
 
-int vmwgfx_create(int fd, struct kms_driver **out);
+_DRM_HIDDEN int vmwgfx_create(int fd, struct kms_driver **out);
 
-int intel_create(int fd, struct kms_driver **out);
+_DRM_HIDDEN int intel_create(int fd, struct kms_driver **out);
 
-int nouveau_create(int fd, struct kms_driver **out);
+_DRM_HIDDEN int nouveau_create(int fd, struct kms_driver **out);
 
 #endif
Signature · 1 line
1.7.1
#2 lore raw

PATCH 3/3 radeon: don't export internal functions

In reply to Julien Cristau

Also drop prototypes for nonexistent functions.

---
 radeon/bof.h |   41 +++++++++++++++++++----------------------
 1 files changed, 19 insertions(+), 22 deletions(-)
radeon/bof.h +19 -22
index 014affb..239c98a 100644
@@ -28,6 +28,7 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#include "xf86drm-internals.h"
 
 #define BOF_TYPE_STRING		0
 #define BOF_TYPE_NULL		1
@@ -51,34 +52,30 @@ typedef struct bof {
 	long		offset;
 } bof_t;
 
-extern int bof_file_flush(bof_t *root);
-extern bof_t *bof_file_new(const char *filename);
-extern int bof_object_dump(bof_t *object, const char *filename);
-
 /* object */
-extern bof_t *bof_object(void);
-extern bof_t *bof_object_get(bof_t *object, const char *keyname);
-extern int bof_object_set(bof_t *object, const char *keyname, bof_t *value);
+extern _DRM_HIDDEN bof_t *bof_object(void);
+extern _DRM_HIDDEN bof_t *bof_object_get(bof_t *object, const char *keyname);
+extern _DRM_HIDDEN int bof_object_set(bof_t *object, const char *keyname, bof_t *value);
 /* array */
-extern bof_t *bof_array(void);
-extern int bof_array_append(bof_t *array, bof_t *value);
-extern bof_t *bof_array_get(bof_t *bof, unsigned i);
-extern unsigned bof_array_size(bof_t *bof);
+extern _DRM_HIDDEN bof_t *bof_array(void);
+extern _DRM_HIDDEN int bof_array_append(bof_t *array, bof_t *value);
+extern _DRM_HIDDEN bof_t *bof_array_get(bof_t *bof, unsigned i);
+extern _DRM_HIDDEN unsigned bof_array_size(bof_t *bof);
 /* blob */
-extern bof_t *bof_blob(unsigned size, void *value);
-extern unsigned bof_blob_size(bof_t *bof);
-extern void *bof_blob_value(bof_t *bof);
+extern _DRM_HIDDEN bof_t *bof_blob(unsigned size, void *value);
+extern _DRM_HIDDEN unsigned bof_blob_size(bof_t *bof);
+extern _DRM_HIDDEN void *bof_blob_value(bof_t *bof);
 /* string */
-extern bof_t *bof_string(const char *value);
+extern _DRM_HIDDEN bof_t *bof_string(const char *value);
 /* int32 */
-extern bof_t *bof_int32(int32_t value);
-extern int32_t bof_int32_value(bof_t *bof);
+extern _DRM_HIDDEN bof_t *bof_int32(int32_t value);
+extern _DRM_HIDDEN int32_t bof_int32_value(bof_t *bof);
 /* common functions */
-extern void bof_decref(bof_t *bof);
-extern void bof_incref(bof_t *bof);
-extern bof_t *bof_load_file(const char *filename);
-extern int bof_dump_file(bof_t *bof, const char *filename);
-extern void bof_print(bof_t *bof);
+extern _DRM_HIDDEN void bof_decref(bof_t *bof);
+extern _DRM_HIDDEN void bof_incref(bof_t *bof);
+extern _DRM_HIDDEN bof_t *bof_load_file(const char *filename);
+extern _DRM_HIDDEN int bof_dump_file(bof_t *bof, const char *filename);
+extern _DRM_HIDDEN void bof_print(bof_t *bof);
 
 static inline int bof_is_object(bof_t *bof){return (bof->type == BOF_TYPE_OBJECT);}
 static inline int bof_is_blob(bof_t *bof){return (bof->type == BOF_TYPE_BLOB);}
Signature · 1 line
1.7.1
#3 lore raw
In reply to Julien Cristau
Quoted 7 lines · Julien Cristau

Introduce a new internal header since that doesn't seem to exist yet. Or maybe I should rename xf86atomic.h instead.

---
 xf86drm-internals.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
 create mode 100644 xf86drm-internals.h

Sorry, forgot to include it in Makefile.am. If the rest of the series is acked I can resend with the fix.

Cheers,
Julien

#4 lore raw
In reply to Julien Cristau

Julien Cristau [2010-06-10 23:50]:

Quoted 13 lines

Introduce a new internal header since that doesn't seem to exist yet. Or maybe I should rename xf86atomic.h instead.

---
 xf86drm-internals.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
 create mode 100644 xf86drm-internals.h
xf86drm-internals.h new file +0 -0
new file mode 100644
index 0000000..bf5ff51

xf86drm-internals.h line 9

Quoted 9 lines
xf86drm-internals.h new file +9 -0
@@ -0,0 +1,12 @@
+#ifndef XF86DRM_INTERNALS_H
+#define XF86DRM_INTERNALS_H
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+# define _DRM_HIDDEN      __attribute__((visibility("hidden")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
+# define _DRM_HIDDEN      __hidden
+#else /* not gcc >= 4 and not Sun Studio >= 8 */
+# define _X_HIDDEN
            ^^^^^^^^^

This should say _DRM_HIDDEN, I guess :)

Quoted 5 lines
xf86drm-internals.h new file +3 -0
+#endif /* GNUC >= 4 */
+
+#endif
Signature · 1 line
1.7.1

Regards,
Tilman

Signature · 4 lines
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 4 lines · Tilman Sauerbeck
Quoted 1 line

+# define _X_HIDDEN

            ^^^^^^^^^

This should say _DRM_HIDDEN, I guess :)

Sigh, yes, thanks.

Cheers,
Julien