fixed dirprot member detection and add code to detect when a node need to checked for kw warnings

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5620 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-01-13 00:52:25 +00:00
commit 96e80c76b7

View file

@ -99,7 +99,8 @@ int need_protected(Node* n, int dirprot_mode)
if (!(Swig_need_protected() || dirprot_mode)) return 0;
/* First, 'n' looks like a function */
if (SwigType_isfunction(Getattr(n,"decl"))) {
if ((Strcmp(nodeType(n),"cdecl") == 0) &&
SwigType_isfunction(Getattr(n,"decl"))) {
String *storage = Getattr(n,"storage");
/* and the function is declared like virtual, or it has no
storage. This eliminates typedef, static and so on. */
@ -107,3 +108,32 @@ int need_protected(Node* n, int dirprot_mode)
}
return 0;
}
/* -----------------------------------------------------------------------------
* int need_name_warning(Node *n)
*
* Detects if a node needs name warnings
*
* ----------------------------------------------------------------------------- */
int need_name_warning(Node *n)
{
int need = 1;
/*
we don't use name warnings for:
- class forwards, no symbol is generated at the target language.
- template declarations, only for real instances using %template(name).
- typedefs, they have no effect at the target language.
*/
if (Strcmp(nodeType(n),"classforward") == 0) {
need = 0;
} else if (Getattr(n,"templatetype")) {
need = 0;
} else {
String *storage = Getattr(n,"storage");
if (storage && (Strcmp(storage,"typedef") == 0)) {
need = 0;
}
}
return need;
}