new warnings because of ctrl constify

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Neels Hofmeyr nhofmeyr at sysmocom.de
Tue Oct 18 00:15:39 UTC 2016


Presumably after this libosmocore commit, I get scores of new warnings (see
below) when compiling openbsc:

commit ed9d6da5df98538adc70aa03cb569eb9505d04b6
Author:     Max <msuraev at sysmocom.de>
AuthorDate: Tue Oct 11 15:20:28 2016 +0200

    Constify ctrl_cmd struct fields where appropriate



Some of these can be fixed by constifying the functions as well, but
talloc_free() of a const char * looks really wrong?

Please follow up on this or revert the commit... constifying is good, but
having twice the amount of warnings means twice the reading effort during
development cycles.

I would most prefer a revert now and come back as soon as no new warnings are
introduced; ymmv...


In file included from /usr/local/include/osmocom/core/talloc.h:4:0,
                 from ../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:22:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c: In function ‘bsc_nat_handle_ctrlif_msg’:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:131:16: warning: passing argument 1 of ‘_talloc_free’ discards ‘const’ qualifier from pointer target type
    talloc_free(cmd->variable);
                ^
/usr/include/talloc.h:227:5: note: expected ‘void *’ but argument is of type ‘const char *’
 int _talloc_free(void *ptr, const char *location);
     ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:143:34: warning: passing argument 2 of ‘bsc_get_pending’ discards ‘const’ qualifier from pointer target type
   pending = bsc_get_pending(bsc, cmd->id);
                                  ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:86:29: note: expected ‘char *’ but argument is of type ‘const char *’
 static struct bsc_cmd_list *bsc_get_pending(struct bsc_connection *bsc, char *id_str)
                             ^
../../../src/osmo-bsc_nat/bsc_ussd.c: In function ‘bsc_ussd_check’:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c: In function ‘forward_to_bsc’:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:228:31: warning: passing argument 1 of ‘extract_bsc_nr_variable’ discards ‘const’ qualifier from pointer target type
  if (!extract_bsc_nr_variable(cmd->variable, &nr, &bsc_variable)) {
                               ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:198:12: note: expected ‘char *’ but argument is of type ‘const char *’
 static int extract_bsc_nr_variable(char *variable, unsigned int *nr, char **bsc_variable)
            ^
In file included from /usr/local/include/osmocom/core/talloc.h:4:0,
                 from ../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:22:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:259:16: warning: passing argument 1 of ‘_talloc_free’ discards ‘const’ qualifier from pointer target type
    talloc_free(bsc_cmd->id);
                ^
/usr/include/talloc.h:227:5: note: expected ‘void *’ but argument is of type ‘const char *’
 int _talloc_free(void *ptr, const char *location);
     ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:266:16: warning: passing argument 1 of ‘_talloc_free’ discards ‘const’ qualifier from pointer target type
    talloc_free(bsc_cmd->variable);
                ^
/usr/include/talloc.h:227:5: note: expected ‘void *’ but argument is of type ‘const char *’
 int _talloc_free(void *ptr, const char *location);
     ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c: In function ‘extract_bsc_cfg_variable’:
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:323:31: warning: passing argument 1 of ‘extract_bsc_nr_variable’ discards ‘const’ qualifier from pointer target type
  if (!extract_bsc_nr_variable(cmd->variable, &nr, bsc_variable)) {
                               ^
../../../src/osmo-bsc_nat/bsc_nat_ctrl.c:198:12: note: expected ‘char *’ but argument is of type ‘const char *’
 static int extract_bsc_nr_variable(char *variable, unsigned int *nr, char **bsc_variable)
            ^




-- 
- Neels Hofmeyr <nhofmeyr at sysmocom.de>          http://www.sysmocom.de/
=======================================================================
* sysmocom - systems for mobile communications GmbH
* Alt-Moabit 93
* 10559 Berlin, Germany
* Sitz / Registered office: Berlin, HRB 134158 B
* Geschäftsführer / Managing Directors: Harald Welte
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.osmocom.org/pipermail/openbsc/attachments/20161018/f99b4201/attachment.bin>


More information about the OpenBSC mailing list