🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51784

inlining & optimization (and registers)

#51784
From: John Garnett
Date: Mon, 29 Mar 1993 19:56
63 lines
2518 bytes
I have two questions (if you don't know the first, feel free to answer the
second and vice versa).

Q1) I have a program that I'm attempting to compile with gcc 2.3.2 using
-O2 as the only flag.  I am seeing warnings that look like this:

lint.h:366: warning: can't inline call to `get_config_int' which was
declared inline [this same warning occurs for many different functions].

Here is the prototype for get_config_int:

INLINE int get_config_int PROT((int num));

where PROT is:

#ifdef __STDC__
#    define PROT(x) x
#else /* __STDC__ */
#    define PROT(x) ()
#endif /* __STDC */

and INLINE is:

#ifndef INLINE
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(lint)
#define INLINE inline
#else
#define INLINE
#endif
#endif

get_config_int looks like this:

INLINE int get_config_int (num)
int num;
{
#ifdef DEBUG
  if (num > NUM_INTS || num < 0)
    {
      fatal ("Bounds error in get_config_int\n");
    }
#endif
  return config_int[num];
}

The warning occurs when compiling main.c and get_config_int is in rc.c.
Could this be the source of the problem?  Am I not able to inline functions
that are declared in source files other than where invoked?  The same
warnings occur when I compile with -O instead of -O2.  The warning does not
occur if I compile without any optimization.

Q2) Is there a way to declare a global variable as a register variable?
Do I have to specify which register to use?  If so, then I imagine I need
the name of the register depends on the cpu being used.  I'm interested in
being directed to documentation that describes this (global variables
as register variables).

Please send a copy of any response to garnett@ccwf.cc.utexas.edu (same
as the reply-to field).

Thanks,

John Garnett
Technical Details
Message-ID: <1p7k97INNkk0@geraldo.cc.utexas.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!elroy.jpl.nasa.gov!usc!cs.utexas.edu!geraldo.cc.utexas.edu!ccwf.cc.utexas.edu!garnett

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5af305fe35634856,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-03-29 13:11:13 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!news.claremont.edu!elroy.jpl.nasa.gov!usc!cs.utexas.edu!geraldo.cc.utexas.edu!ccwf.cc.utexas.edu!garnett
From: garnett@ccwf.cc.utexas.edu (John Garnett)
Newsgroups: gnu.gcc.help
Subject: inlining & optimization (and registers)
Date: 29 Mar 1993 19:56:23 GMT
Organization: The University of Texas at Austin, Austin TX
Lines: 63
Message-ID: <1p7k97INNkk0@geraldo.cc.utexas.edu>
Reply-To: garnett@ccwf.cc.utexas.edu (John Garnett)
NNTP-Posting-Host: sneezy.cc.utexas.edu
Originator: garnett@sneezy.cc.utexas.edu