Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #11807

Re: Multi-instructions macro and compiler warning

From "BartC" <bc@freeuk.com>
Newsgroups comp.lang.c
Subject Re: Multi-instructions macro and compiler warning
Date 2011-10-17 13:10 +0100
Organization A noiseless patient Spider
Message-ID <j7h601$j2$1@dont-email.me> (permalink)
References <j7e002$64g$1@nnrp.ngi.it> <9fvfilF3u9U2@mid.individual.net> <j7e1qm$7te$1@nnrp.ngi.it> <j7eg8h$k95$1@dont-email.me> <8a974a79-9ee2-4f6f-8aa6-795b80b03080@x20g2000vbl.googlegroups.com>

Show all headers | View raw


"pozz" <pozzugno@gmail.com> wrote in message 
news:8a974a79-9ee2-4f6f-8aa6-795b80b03080@x20g2000vbl.googlegroups.com...
> On 16 Ott, 13:47, "BartC" <b...@freeuk.com> wrote:

>> The code will be duplicated in each module, but that will happen many 
>> times
>> anyway if you want the function to be inlined.

> -- test.h --
> #ifndef TEST_H
> #define TEST_H
>
> #pragma inline relay_on
> static void relay_on(void) {
>  PIN_SET_OUTPUT(10);
>  PIN_SET(PIN(10));
> }
>
> #endif
> --
>
> but now I receive a warning message from the compiler if one module
> includes
> test.h without using relay_on() function (and this could be possible,
> because
> I usually have other definitions in the include file):
>
>  W1204C: static symbol `relay_on' unused
>
> It's a nightmare...

No, it's just a warning, not an error.

You can ignore the warning. Or find some compiler switch that turns the 
warning off.

Or create a more complex include file scheme, so that these functions are 
declared in their own header, and included only when used. Or use a dummy 
function that makes use of 'relay_on' (that's assuming that doesn't generate 
yet another warning about not calling the dummy function...)

-- 
Bartc 

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-16 09:09 +0200
  Re: Multi-instructions macro and compiler warning Ian Collins <ian-news@hotmail.com> - 2011-10-16 20:31 +1300
    Re: Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-16 09:41 +0200
      Re: Multi-instructions macro and compiler warning Ian Collins <ian-news@hotmail.com> - 2011-10-16 20:49 +1300
        Re: Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-16 10:16 +0200
          Re: Multi-instructions macro and compiler warning Ian Collins <ian-news@hotmail.com> - 2011-10-16 23:09 +1300
            Re: Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-17 02:37 -0700
              Re: Multi-instructions macro and compiler warning Ian Collins <ian-news@hotmail.com> - 2011-10-17 23:04 +1300
              Re: Multi-instructions macro and compiler warning Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-17 11:06 +0100
                Re: Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-17 03:23 -0700
              Re: Multi-instructions macro and compiler warning Keith Thompson <kst-u@mib.org> - 2011-10-17 12:30 -0700
      Re: Multi-instructions macro and compiler warning "BartC" <bc@freeuk.com> - 2011-10-16 12:47 +0100
        Re: Multi-instructions macro and compiler warning Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-16 22:16 +0000
        Re: Multi-instructions macro and compiler warning pozz <pozzugno@gmail.com> - 2011-10-17 02:42 -0700
          Re: Multi-instructions macro and compiler warning "BartC" <bc@freeuk.com> - 2011-10-17 13:10 +0100
      Re: Multi-instructions macro and compiler warning bert <bert.hutchings@btinternet.com> - 2011-10-16 05:33 -0700
  Re: Multi-instructions macro and compiler warning Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-16 09:02 -0400
  Re: Multi-instructions macro and compiler warning "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2011-10-16 07:40 -0700
    Re: Multi-instructions macro and compiler warning ImpalerCore <jadill33@gmail.com> - 2011-10-17 08:07 -0700
      Re: Multi-instructions macro and compiler warning "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2011-10-17 09:25 -0700
        Re: Multi-instructions macro and compiler warning James Kuyper <jameskuyper@verizon.net> - 2011-10-17 12:58 -0400
          Re: Multi-instructions macro and compiler warning Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-18 07:43 -0400
            Re: Multi-instructions macro and compiler warning Keith Thompson <kst-u@mib.org> - 2011-10-18 11:52 -0700
        Re: Multi-instructions macro and compiler warning ImpalerCore <jadill33@gmail.com> - 2011-10-17 10:41 -0700
  Re: Multi-instructions macro and compiler warning Jean-Christophe <5.d@free.fr> - 2011-10-16 10:02 -0700
    Re: Multi-instructions macro and compiler warning Kleuskes & Moos <kleuske@somewhere.else.net> - 2011-10-16 17:44 +0000
    Re: Multi-instructions macro and compiler warning Keith Thompson <kst-u@mib.org> - 2011-10-16 13:49 -0700
      Re: Multi-instructions macro and compiler warning Ian Collins <ian-news@hotmail.com> - 2011-10-17 10:00 +1300
  Re: Multi-instructions macro and compiler warning Kenneth Brody <kenbrody@spamcop.net> - 2011-10-17 12:50 -0400
    Re: Multi-instructions macro and compiler warning "Morris Keesan" <mkeesan@post.harvard.edu> - 2011-10-17 14:50 -0400

csiph-web