public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ‘xref_tag’ lacks a public declaration
@ 2011-03-16  9:50 Ludovic Courtès
  2011-03-16 14:38 ` Ian Lance Taylor
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2011-03-16  9:50 UTC (permalink / raw)
  To: gcc

Hello,

‘c-common.h’ lacks this declaration:

  extern tree xref_tag (enum tree_code code, tree name);

AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
tag.

Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
so it seems that the above declaration cannot just be added to
‘c-common.h’.

Any ideas how to solve this?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16  9:50 ‘xref_tag’ lacks a public declaration Ludovic Courtès
@ 2011-03-16 14:38 ` Ian Lance Taylor
  2011-03-16 14:54   ` Ludovic Courtès
  2011-03-17  9:07   ` Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Ian Lance Taylor @ 2011-03-16 14:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc

ludovic.courtes@inria.fr (Ludovic Courtès) writes:

> ‘c-common.h’ lacks this declaration:
>
>   extern tree xref_tag (enum tree_code code, tree name);
>
> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
> tag.
>
> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
> so it seems that the above declaration cannot just be added to
> ‘c-common.h’.
>
> Any ideas how to solve this?

Any plugin that uses that function is going to be inherently specific to
the C frontend, and will not work with C++.  So it will have to #include
c-tree.h.  That in turn would presumably require adding $(C_TREE_H) to
PLUGIN_HEADERS in gcc/Makefile.in.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16 14:38 ` Ian Lance Taylor
@ 2011-03-16 14:54   ` Ludovic Courtès
  2011-03-16 15:17     ` Ian Lance Taylor
  2011-03-17  9:07   ` Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2011-03-16 14:54 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Hi,

Ian Lance Taylor <iant@google.com> writes:

> ludovic.courtes@inria.fr (Ludovic Courtès) writes:
>
>> ‘c-common.h’ lacks this declaration:
>>
>>   extern tree xref_tag (enum tree_code code, tree name);
>>
>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>> tag.
>>
>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>> so it seems that the above declaration cannot just be added to
>> ‘c-common.h’.
>>
>> Any ideas how to solve this?
>
> Any plugin that uses that function is going to be inherently specific to
> the C frontend, and will not work with C++.

How would you recommend to work around the problem in the meantime?

> So it will have to #include
> c-tree.h.  That in turn would presumably require adding $(C_TREE_H) to
> PLUGIN_HEADERS in gcc/Makefile.in.

See patch below (INRIA has a copyright assignment on file):


[-- Attachment #2: Type: text/x-patch, Size: 1446 bytes --]

From: Ludovic Courtès <ludo@gnu.org>
Subject: [PATCH] t/install-c-tree-h

Install <c-tree.h>, for use by plug-ins.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>

---
 gcc/ChangeLog   |    5 +++++
 gcc/Makefile.in |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5ee0836..db68fdf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-16  Ludovic Courtès  <ludovic.courtes@inria.fr>
+
+       * Makefile.in (PLUGIN_HEADERS): Add $(C_TREE_H).  Suggested by
+       Ian Lance Taylor <iant@google.com>.
+
 2011-03-16  Jakub Jelinek  <jakub@redhat.com>
 
        * emit-rtl.c (try_split): Don't call copy_call_info debug hook.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index b4de74b..393c0c4 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4519,7 +4519,8 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   $(EXCEPT_H) tree-ssa-sccvn.h real.h output.h $(IPA_UTILS_H) \
   $(C_PRAGMA_H)  $(CPPLIB_H)  $(FUNCTION_H) \
   cppdefault.h flags.h $(MD5_H) params.def params.h prefix.h tree-inline.h \
-  $(IPA_PROP_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) version.h
+  $(IPA_PROP_H) $(RTL_H) $(TM_P_H) $(CFGLOOP_H) $(EMIT_RTL_H) version.h \
+  $(C_TREE_H)
 
 # generate the 'build fragment' b-header-vars
 s-header-vars: Makefile
-- 
tg: (18b7c11..) t/install-c-tree-h (depends on: master)

[-- Attachment #3: Type: text/plain, Size: 21 bytes --]


Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16 14:54   ` Ludovic Courtès
@ 2011-03-16 15:17     ` Ian Lance Taylor
  2011-03-16 15:28       ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Lance Taylor @ 2011-03-16 15:17 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc

ludovic.courtes@inria.fr (Ludovic Courtès) writes:

>>>   extern tree xref_tag (enum tree_code code, tree name);
>>>
>>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>>> tag.
>>>
>>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>>> so it seems that the above declaration cannot just be added to
>>> ‘c-common.h’.
>>>
>>> Any ideas how to solve this?
>>
>> Any plugin that uses that function is going to be inherently specific to
>> the C frontend, and will not work with C++.
>
> How would you recommend to work around the problem in the meantime?

Add the extern declaration in the plugin, rather than relying on a
header file.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16 15:17     ` Ian Lance Taylor
@ 2011-03-16 15:28       ` Ludovic Courtès
  2011-03-16 17:24         ` Ian Lance Taylor
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2011-03-16 15:28 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

Ian Lance Taylor <iant@google.com> writes:

> ludovic.courtes@inria.fr (Ludovic Courtès) writes:
>
>>>>   extern tree xref_tag (enum tree_code code, tree name);
>>>>
>>>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>>>> tag.
>>>>
>>>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>>>> so it seems that the above declaration cannot just be added to
>>>> ‘c-common.h’.
>>>>
>>>> Any ideas how to solve this?
>>>
>>> Any plugin that uses that function is going to be inherently specific to
>>> the C frontend, and will not work with C++.
>>
>> How would you recommend to work around the problem in the meantime?
>
> Add the extern declaration in the plugin, rather than relying on a
> header file.

I’m doing this already but I think providing the declaration is a better
long-term solution.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16 15:28       ` Ludovic Courtès
@ 2011-03-16 17:24         ` Ian Lance Taylor
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Lance Taylor @ 2011-03-16 17:24 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc

ludovic.courtes@inria.fr (Ludovic Courtès) writes:

> Ian Lance Taylor <iant@google.com> writes:
>
>> ludovic.courtes@inria.fr (Ludovic Courtès) writes:
>>
>>>>>   extern tree xref_tag (enum tree_code code, tree name);
>>>>>
>>>>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>>>>> tag.
>>>>>
>>>>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>>>>> so it seems that the above declaration cannot just be added to
>>>>> ‘c-common.h’.
>>>>>
>>>>> Any ideas how to solve this?
>>>>
>>>> Any plugin that uses that function is going to be inherently specific to
>>>> the C frontend, and will not work with C++.
>>>
>>> How would you recommend to work around the problem in the meantime?
>>
>> Add the extern declaration in the plugin, rather than relying on a
>> header file.
>
> I’m doing this already but I think providing the declaration is a better
> long-term solution.

Of course.  The long-term solution is a patch like the one you sent.  My
paragraph quoted above is my answer to your question about what you
should do in the meantime.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-16 14:38 ` Ian Lance Taylor
  2011-03-16 14:54   ` Ludovic Courtès
@ 2011-03-17  9:07   ` Ludovic Courtès
  2011-03-18  1:27     ` Ian Lance Taylor
  1 sibling, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2011-03-17  9:07 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc

Hi,

Ian Lance Taylor <iant@google.com> writes:

> ludovic.courtes@inria.fr (Ludovic Courtès) writes:
>
>> ‘c-common.h’ lacks this declaration:
>>
>>   extern tree xref_tag (enum tree_code code, tree name);
>>
>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>> tag.
>>
>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>> so it seems that the above declaration cannot just be added to
>> ‘c-common.h’.
>>
>> Any ideas how to solve this?
>
> Any plugin that uses that function is going to be inherently specific to
> the C frontend, and will not work with C++.

BTW, what equivalent function would work with both C and C++?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: ‘xref_tag’ lacks a public declaration
  2011-03-17  9:07   ` Ludovic Courtès
@ 2011-03-18  1:27     ` Ian Lance Taylor
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Lance Taylor @ 2011-03-18  1:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: gcc

ludovic.courtes@inria.fr (Ludovic Courtès) writes:

>>> ‘c-common.h’ lacks this declaration:
>>>
>>>   extern tree xref_tag (enum tree_code code, tree name);
>>>
>>> AFAICS it makes it impossible for plug-ins to lookup a struct/union/enum
>>> tag.
>>>
>>> Unfortunately, <cp/cp-tree.h> declares a different ‘xref_tag’ function,
>>> so it seems that the above declaration cannot just be added to
>>> ‘c-common.h’.
>>>
>>> Any ideas how to solve this?
>>
>> Any plugin that uses that function is going to be inherently specific to
>> the C frontend, and will not work with C++.
>
> BTW, what equivalent function would work with both C and C++?

As far as I know, there isn't one.  I know it seems like a reasonable
question to ask, but the two frontends are different, and they are never
linked together in the same executable.

Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-18  1:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-16  9:50 ‘xref_tag’ lacks a public declaration Ludovic Courtès
2011-03-16 14:38 ` Ian Lance Taylor
2011-03-16 14:54   ` Ludovic Courtès
2011-03-16 15:17     ` Ian Lance Taylor
2011-03-16 15:28       ` Ludovic Courtès
2011-03-16 17:24         ` Ian Lance Taylor
2011-03-17  9:07   ` Ludovic Courtès
2011-03-18  1:27     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).