Skip to content

Commit

Permalink
fix gcc12 warnings (from upstream)
Browse files Browse the repository at this point in the history
  • Loading branch information
wlav committed Nov 1, 2023
1 parent daf4b5f commit 49d6c74
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 48 deletions.
28 changes: 8 additions & 20 deletions cling/src/build/rmkdepend/include.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,21 @@ extern char *notdotdot[ ];
extern boolean show_where_not;
extern boolean warn_multiple;


boolean
isdot(p)
register char *p;
boolean isdot(register char *p)
{
if (p && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}

boolean
isdotdot(p)
register char *p;
boolean isdotdot(register char *p)
{
if (p && *p++ == '.' && *p++ == '.' && *p++ == '\0')
return(TRUE);
return(FALSE);
}

boolean
issymbolic(dir, component)
register char *dir, *component;
boolean issymbolic(register char *dir, register char *component)
{
#ifdef S_IFLNK
struct stat st;
Expand Down Expand Up @@ -89,9 +82,7 @@ register char *dir, *component;
* Any of the 'x/..' sequences within the name can be eliminated.
* (but only if 'x' is not a symbolic link!!)
*/
void
remove_dotdot(path)
char *path;
void remove_dotdot(char *path)
{
register char *end, *from, *to, **cp;
char *components[ MAXFILES ],
Expand Down Expand Up @@ -161,8 +152,7 @@ char *path;
/*
* Add an include file to the list of those included by 'file'.
*/
struct inclist *newinclude(newfile, incstring)
register char *newfile, *incstring;
struct inclist *newinclude(register char *newfile, register char *incstring)
{
register struct inclist *ip;

Expand All @@ -182,9 +172,7 @@ struct inclist *newinclude(newfile, incstring)
return(ip);
}

void
included_by(ip, newfile)
register struct inclist *ip, *newfile;
void included_by(register struct inclist *ip, register struct inclist *newfile)
{
register int i;

Expand Down Expand Up @@ -311,11 +299,11 @@ struct inclist *inc_path(char *file, char *include, boolean dot) {
*/
if (!found)
for (pp = includedirs; *pp; pp++) {
if (strlen(*pp) + strlen(include) + 2 > sizeof(path)) {
int retlen = snprintf(path, BUFSIZ, "%s/%s", *pp, include);
if (retlen <= 0 || BUFSIZ < retlen) {
warning1("\t%s/%s too long\n", *pp, include);
continue;
}
sprintf(path, "%s/%s", *pp, include);
remove_dotdot(path);
#ifdef _WIN32
if (stat(path, &st) == 0 && (st.st_mode & S_IFREG)) {
Expand Down
12 changes: 8 additions & 4 deletions cling/src/core/cont/inc/TList.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,14 @@ class TObjOptLink : public TObjLink {
// Iterator of linked list. //
// //
//////////////////////////////////////////////////////////////////////////
class TListIter : public TIterator,
public std::iterator<std::bidirectional_iterator_tag,
TObject*, std::ptrdiff_t,
const TObject**, const TObject*&> {
class TListIter : public TIterator {
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = TObject *;
using difference_type = std::ptrdiff_t;
using pointer = TObject **;
using const_pointer = const TObject **;
using reference = const TObject *&;

protected:
using TObjLinkPtr_t = std::shared_ptr<TObjLink>;
Expand Down
12 changes: 8 additions & 4 deletions cling/src/core/cont/inc/TMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,14 @@ typedef TPair TAssoc; // for backward compatibility
// //
//////////////////////////////////////////////////////////////////////////

class TMapIter : public TIterator,
public std::iterator<std::bidirectional_iterator_tag,
TObject*, std::ptrdiff_t,
const TObject**, const TObject*&> {
class TMapIter : public TIterator {
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = TObject *;
using difference_type = std::ptrdiff_t;
using pointer = TObject **;
using const_pointer = const TObject **;
using reference = const TObject *&;

private:
const TMap *fMap; //map being iterated
Expand Down
12 changes: 8 additions & 4 deletions cling/src/core/cont/inc/TObjArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ friend class TObjArrayIter;
// //
//////////////////////////////////////////////////////////////////////////

class TObjArrayIter : public TIterator,
public std::iterator<std::bidirectional_iterator_tag, // TODO: ideally it should be a randomaccess_iterator_tag
TObject*, std::ptrdiff_t,
const TObject**, const TObject*&> {
class TObjArrayIter : public TIterator {
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = TObject *;
using difference_type = std::ptrdiff_t;
using pointer = TObject **;
using const_pointer = const TObject **;
using reference = const TObject *&;

private:
const TObjArray *fArray; //array being iterated
Expand Down
12 changes: 8 additions & 4 deletions cling/src/core/cont/inc/TOrdCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ friend class TOrdCollectionIter;
// //
//////////////////////////////////////////////////////////////////////////

class TOrdCollectionIter : public TIterator,
public std::iterator<std::bidirectional_iterator_tag,
TObject*, std::ptrdiff_t,
const TObject**, const TObject*&> {
class TOrdCollectionIter : public TIterator {
public:
using iterator_category = std::bidirectional_iterator_tag;
using value_type = TObject *;
using difference_type = std::ptrdiff_t;
using pointer = TObject **;
using const_pointer = const TObject **;
using reference = const TObject *&;

private:
const TOrdCollection *fCol; //collection being iterated
Expand Down
20 changes: 8 additions & 12 deletions cling/src/core/unix/src/TUnixSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -656,17 +656,13 @@ void TUnixSystem::SetDisplay()
STRUCT_UTMP *utmp_entry = utmp.SearchUtmpEntry(tty);
if (utmp_entry) {
if (utmp_entry->ut_host[0]) {
if (strchr(utmp_entry->ut_host, ':')) {
Setenv("DISPLAY", utmp_entry->ut_host);
Warning("SetDisplay", "DISPLAY not set, setting it to %s",
utmp_entry->ut_host);
} else {
char disp[260];
snprintf(disp, sizeof(disp), "%s:0.0", utmp_entry->ut_host);
Setenv("DISPLAY", disp);
Warning("SetDisplay", "DISPLAY not set, setting it to %s",
disp);
}
TString disp;
for (unsigned n = 0; (n < sizeof(utmp_entry->ut_host)) && utmp_entry->ut_host[n]; n++)
disp.Append(utmp_entry->ut_host[n]);
if (disp.First(':') == kNPOS)
disp.Append(":0.0");
Setenv("DISPLAY", disp.Data());
Warning("SetDisplay", "DISPLAY not set, setting it to %s", disp.Data());
}
#ifndef UTMP_NO_ADDR
else if (utmp_entry->ut_addr) {
Expand All @@ -681,7 +677,7 @@ void TUnixSystem::SetDisplay()
char hbuf[NI_MAXHOST + 4];
if (getnameinfo(sa, sizeof(struct sockaddr), hbuf, sizeof(hbuf), nullptr, 0, NI_NAMEREQD) == 0) {
assert( strlen(hbuf) < NI_MAXHOST );
strcat(hbuf, ":0.0");
strlcat(hbuf, ":0.0", sizeof(hbuf));
Setenv("DISPLAY", hbuf);
Warning("SetDisplay", "DISPLAY not set, setting it to %s",
hbuf);
Expand Down

0 comments on commit 49d6c74

Please sign in to comment.